Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
Expanded. Enabled syntax highlighting (as a result, the diff looks more extensive than it really is - use view "Side-by-side Markdown" to compare).
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

Socket.io 1.7.3(+) or later:

 function getConnectedList () { let list = [] for ( let client in io.sockets.connected ) { list.push(client) } return list } console.log( getConnectedList() ) // returns [ 'yIfhb2tw7mxgrnF6AAAA', 'qABFaNDSYknCysbgAAAB' ] function getConnectedList () { let list = [] for (let client in io.sockets.connected) { list.push(client) } return list } console.log(getConnectedList()) // returns [ 'yIfhb2tw7mxgrnF6AAAA', 'qABFaNDSYknCysbgAAAB' ] 

Socket.io 1.7.3(+) :

 function getConnectedList () { let list = [] for ( let client in io.sockets.connected ) { list.push(client) } return list } console.log( getConnectedList() ) // returns [ 'yIfhb2tw7mxgrnF6AAAA', 'qABFaNDSYknCysbgAAAB' ] 

Socket.io 1.7.3 or later:

function getConnectedList () { let list = [] for (let client in io.sockets.connected) { list.push(client) } return list } console.log(getConnectedList()) // returns [ 'yIfhb2tw7mxgrnF6AAAA', 'qABFaNDSYknCysbgAAAB' ] 
Commonmark migration
Source Link

#Socket.io 1.7.3(+) :

Socket.io 1.7.3(+) :

 function getConnectedList () { let list = [] for ( let client in io.sockets.connected ) { list.push(client) } return list } console.log( getConnectedList() ) // returns [ 'yIfhb2tw7mxgrnF6AAAA', 'qABFaNDSYknCysbgAAAB' ] 

#Socket.io 1.7.3(+) :

 function getConnectedList () { let list = [] for ( let client in io.sockets.connected ) { list.push(client) } return list } console.log( getConnectedList() ) // returns [ 'yIfhb2tw7mxgrnF6AAAA', 'qABFaNDSYknCysbgAAAB' ] 

Socket.io 1.7.3(+) :

 function getConnectedList () { let list = [] for ( let client in io.sockets.connected ) { list.push(client) } return list } console.log( getConnectedList() ) // returns [ 'yIfhb2tw7mxgrnF6AAAA', 'qABFaNDSYknCysbgAAAB' ] 
Source Link

#Socket.io 1.7.3(+) :

 function getConnectedList () { let list = [] for ( let client in io.sockets.connected ) { list.push(client) } return list } console.log( getConnectedList() ) // returns [ 'yIfhb2tw7mxgrnF6AAAA', 'qABFaNDSYknCysbgAAAB' ]