0.0.2 • Published 9 years ago

nodulator-socket v0.0.2

Weekly downloads
11
License
0
Repository
github
Last release
9 years ago

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 passport session

JumpTo


Installation

You can automaticaly install Nodulator and Nodulator-Socket by running

$> sudo npm install -g Nodulator
$> Nodulator install socket

Or you can just run npm :

$> npm install nodulator nodulator-socket

Basics

Nodulator = require 'nodulator'
Socket = require 'nodulator-socket'

Nodulator.Use Socket

It 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 = Socket

Rooms

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.coffee

The 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

02/01/15: v0.0.2

  • Improved README

30/12/14: v0.0.1

  • Initial commit