Created
October 12, 2017 12:20
-
-
Save nhanco/c5841a7591e19ea448e54883699167ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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