indutny / sticky-session

Sticky session balancer based on a `cluster` module
964 stars 99 forks source link

Using sticky-session with hapi.js #27

Open taktran opened 9 years ago

taktran commented 9 years ago

Are there any tips on how to use sticky-session with hapijs + socket.io (while using glue). I have a server.js which looks like

var Composer = require('./index');

Composer(function (err, server) {

    if (err) {
        throw err;
    }

    server.start(function () {
      // Server started
    });
});

where index.js looks like

// ...
module.exports = Glue.compose.bind(Glue, Manifest.get('/'), composeOptions);

Basically, based off https://github.com/jedireza/frame

On the socket.io side, I have a webSockets.js plugin defined in the manifest file, that looks like

exports.register = function(server, options, next) {
    io = socketIO.listen(server.listener);

    // ...
    next();
}

exports.register.attributes = {
    name: 'webSockets'
};

My main question is where would I hook in sticky session - in the server file or the websocket file, or do I need to remove the use of glue altogether?

roymap commented 8 years ago

any answers to this question?

mashaalmemon commented 8 years ago

Any answers to this question as yet?

felipekm commented 7 years ago

Maybe @hueniverse could help on this?