0.0.4 • Published 6 years ago

socket.io-adapter-sequelize v0.0.4

Weekly downloads
12
License
MIT
Repository
github
Last release
6 years ago

socket.io-adapter-sequelize

npm license dependancies dependanciesdev

Install

npm install socket.io-adapter-sequelize

How to use

var io = require('socket.io')(3000);
var SequelizeAdapter = require('socket.io-adapter-sequelize');

var dbconfig = {
      'database': 'test-db',
      'username': 'user',
      'password': 'pass',            
      'dialect': 'sqlite',
      'storage': 'test/test-db.sqlite',
      'logging': false
    }

var sequelize = new Sequelize(dbconfig)
io.adapter(SequelizeAdapter(sequelize));

API

adapter(sequelize, opts)

sequelize is an existing connected Sequelize object.

adapter(opts)

The following options are allowed:

  • tableName: the name of the table that will be created and used within your connected database
  • processEvery: milliseconds for how often the check for new messages will be run. defaults to 1000 i.e. 1 second.

When to use

Use when you want to use a sequelize compatable database to pass events between nodes when working with clusters.

Credit

Inspired by the other socket.io adapters. Particularly the redis and rethinkdb ones. Thanks

License

MIT

0.0.4

6 years ago

0.0.3

6 years ago

0.0.1

6 years ago