nodulator-socket v0.0.2
Nodulator-Socket
Socket.io module implementation for Nodulator
Concept
Provides server-side socket.io implementation for Nodulator
Features
- General implementation for
socket.io - Room system
- Link with
passportsession
JumpTo
Installation
You can automaticaly install Nodulator and Nodulator-Socket by running
$> sudo npm install -g Nodulator
$> Nodulator install socketOr you can just run npm :
$> npm install nodulator nodulator-socketBasics
Nodulator = require 'nodulator'
Socket = require 'nodulator-socket'
Nodulator.Use SocketIt adds Nodulator.Socket() function that you can extend
This interface provides 2 methods to override :
@OnConnect(socket)@OnDisconnect(socket)
Nodulator = require 'nodulator'
class Socket extends Nodulator.Socket()
OnConnect: (socket) ->
console.log 'Socket connected: ', socket
Socket.Init()
module.exports = SocketRooms
Each time a Resource is initialized, it create a new room and place each new connecting sockets into it.
Then it listen for every Resource events (new{resource_name}, update{resourcename}, delete{resource_name}) and broadcast theses to the attached room (and so to each sockets)
(See Nodulator Bus)
Project Generation
See Nodulator's project generation
When calling $> Nodulator init, it will automaticaly create following structure if non-existant:
server
└─ sockets
└─ index.coffeeThe index.coffee file is a pre-extended Nodulator.Socket() class
TODO
- Repair passport session and socket.io match system (passportSocketIO)
- Provide a filter to apply permissions on specific resource room
Changelog
03/01/15: v0.0.3
- passport.socketio isnt loaded anymore if Nodulator-Account module is missing.
02/01/15: v0.0.2
- Improved README
30/12/14: v0.0.1
- Initial commit