mattstyles / koa-socket

Sugar for connecting socket.io to a koa instance
242 stars 50 forks source link

How do we use socket.io adapters when we have more than one node? #29

Closed gabzim closed 7 years ago

gabzim commented 7 years ago

for instance using: https://github.com/socketio/socket.io-redis

gabzim commented 7 years ago

Answer:

// ... import * as socketRedis from "socket.io-redis";

let app = new koa();
let io = new IO();

io.attach(app);
app._io.adapter(socketRedis({ host: <REDIS_HOST>, port: <REDIS_PORT> }));