Skip to content

Instantly share code, notes, and snippets.

@nhanco
Created October 12, 2017 12:20
Show Gist options
  • Save nhanco/c5841a7591e19ea448e54883699167ef to your computer and use it in GitHub Desktop.
Save nhanco/c5841a7591e19ea448e54883699167ef to your computer and use it in GitHub Desktop.
global.io.on('connection', (socket) => {
socket.setMaxListeners(20);
console.log('index connected')
socket.emit('notification', {
unread: 2,
list: [{
requestor: {
name: 'hello',
id: 'word',
avatar:'https://semantic-ui.com/images/avatar2/small/rachel.png'
},
type: 'addFriend',
content: 'content',
createdAt: new Date()
},
{
requestor: {
name: 'hello',
id: 'word',
avatar:'https://semantic-ui.com/images/avatar/small/jenny.jpg'
},
type: 'gotLicense',
content: 'content',
createdAt: new Date()
}]
});
socket.on('disconnect', () => {
setTimeout(() => socket.disconnect(true), 5000);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment