zero-socket
v0.0.9
Published
Provide a way to use socket as easy as use express router handler.
Downloads
6
Readme
zero-socket
Provide a way to use socket as easy as use express router handler.
Usage
- Add dependency to your module package.json file like:
{
"name" : "YOUR_MODULE_NAME",
"zero" : {
"dependencies" : {
"socket" : "^0.0.1"
}
}
}
- declare
socket
in your module like :
module.exports = {
socket : {
whoAmi: function ( dataFromClient, socket, io) {
socket.emit("whoAreYou", socket.session.user )
}
}
}
Yes, it is as simple as a standard request, you can even use session direct through the passed in arguments socket
.
For more example, please checkout module zero-chat
, which helps to build a chat room app.