Connexa should allow you to "namespace" their sockets, which essentially means assigning endpoints or paths.
This is a useful feature to minimize the number of resources (TCP connections) and at the same time separate concerns within your application by introducing separated between communication channels.
Default namespace
We call the default namespace / and it's the one Connexa clients connect to by default and the one the server listens to by default.
This namespace is identified by server:
server.emit('hi', 'everyone');
Each namespace emits a connection event that receives each Socket instance as a parameter
server.on('connection', (socket) {
socket.on('disconnect', (_) { });
});
Custom namespaces
To set up a custom namespace, you can call the of function on the server-side:
var nsp = server.of('/my-namespace');
nsp.on('connection', function(socket) {
print('client connected > ' + socket.id);
});
nsp.emit('hi', 'I live!');
On the client side, you tell Connexa client to connect to that namespace:
var socket = Connexa.connect('/my-namespace');
Connexa should allow you to "namespace" their sockets, which essentially means assigning endpoints or paths.
This is a useful feature to minimize the number of resources (TCP connections) and at the same time separate concerns within your application by introducing separated between communication channels.
Default namespace
We call the default namespace
/and it's the one Connexa clients connect to by default and the one the server listens to by default.This namespace is identified by
server:Each namespace emits a
connectionevent that receives eachSocketinstance as a parameterCustom namespaces
To set up a custom namespace, you can call the
offunction on the server-side:On the client side, you tell Connexa client to connect to that namespace: