Skip to content

Instantly share code, notes, and snippets.

View shubik's full-sized avatar

Alexander shubik

  • Teradek LLC
  • Irvine, CA
  • 06:31 (UTC +03:00)
View GitHub Profile
@shubik
shubik / gist:5723868
Created June 6, 2013 18:42
Using RedisStore with Socketio
var RedisStore = require('socket.io/lib/stores/redis'),
pub = redis.createClient(),
sub = redis.createClient(),
cmd = redis.createClient();
io.set('store', new RedisStore({
redisPub: pub,
redisSub: sub,
redisClient: cmd
}));
var UserModel = require('./_user_model'),
user = new UserModel();
user(function(model) {
model.set({
name: 'Shubik',
email: 'farennikov@gmail.com'
});
model.save()(function(model) {
var ModelConstructor = function(id) {
// some code...
this._loading = deferred();
this._ready = this._loading.promise;
// more code...
}