how to create/join a namespace in a room on socket.io? -


i use namespaces in room's socket.io features.

i know usefull reminder rooms can see:

  1. a way emit sockets on namespace's room io.of('namespace').in('room').emit('event_name', data)
  2. a way list of sockets in namespace's room io.of('namespace').clients('room')

but page desn't provide way create/join socket specific namespace in specific room.

how that? have try following example without success:

socket.join('city').in('district'); io.of('district').clients('/city'); // [] io.of('/district').clients('/city'); // [] 

you can't join/leave namespaces. namespace part of url when first connect

for example, connecting "http://localhost/district" connect "district" namespace.

on server, can join rooms in namespace this:

io.of('/district').on('connection', function(socket){     socket.join('city'); }); 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -