Questions tagged [socket.io-redis]

Adapter to enable broadcasting of events to multiple separate socket.io server nodes.

By running socket.io with the socket.io-redis adapter you can run multiple socket.io instances in different processes or servers that can all broadcast and emit events to and from each other.

If you need to emit events to socket.io instances from a non-socket.io process, you should use socket.io-emitter.

See also

Installing:

$ npm install socket.io
112 questions
2
votes
1 answer

Laravel-echo-server: how to listen to user leaving a channel

I've been fiddling a lot lately with Laravel Echo and Laravel Echo Server, a socket.io server implementation for Laravel Echo. There's not much on the web, and I'm probably missing some point.. I can see from the cli of laravel-echo-server when a…
Edo San
  • 58
  • 8
2
votes
1 answer

Force client disconnect by socket id

I'd like to force client disconnect by socket id using socket.io-redis. I tried a lot of research in google, but methods mentioned in old topics does not work. Let's say, I'm making clustered application and my code at the moment runs at cluster1…
Nika
  • 1,864
  • 3
  • 23
  • 44
2
votes
0 answers

How to get all connected sockets using socket.io-redis?

I have my multiple nodes running through socket.io-redis, Everything is working fine as I am emitting events to 1 server from another. I want to get the full list of connected sockets on multiple servers together, as I have to manipulate their keys…
Hardeep Mehta
  • 469
  • 1
  • 6
  • 17
2
votes
2 answers

io.on is not working while making connection using socket.io in laravel 5.2

i am facing problem (i really frustrated), while i connecting the io.on function. i am using express,ioredis and socket.io. redis working properly but socket.io is not working. it is'nt working.please help. var app = require('express')(); var…
2
votes
2 answers

redis-server offline crashes node

I am having one heck of a time here. I have read through so much documentation, and other peoples questions regarding the same topic and cannot find an answer on how to stop this from happening. I am purposely shutting down the redis server to try…
2
votes
0 answers

Socket IO Performance cost comparison between rooms and events

In my application, i'm using redis adapter for socket.io I have scenario where I have to create chat rooms for a chat between two people dynamically But I already have rooms for their userid Now, is there a benefit of performance when I create chat…
2
votes
1 answer

How does socket.io-redis deal with rooms?

If I have multiple processes and am using socket.io-redis, when I do io.to(room).emit(namespace, message); is this handled seamlessly and efficiently? Or am I misunderstanding socket.io-redis's role?
John Bachir
  • 22,495
  • 29
  • 154
  • 227
2
votes
2 answers

How to use socket.io-redis with multiple servers?

i have following code on two machines var server = require('http').createServer(app); io = require('socket.io')(server); var redisAdapter = require('socket.io-redis'); io.adapter(redisAdaptebr({host:…
Husnain Ashfaq
  • 142
  • 1
  • 7
2
votes
1 answer

Scaling express/node.js with socket.io horizontally with redis

I am trying to scale by express backend. The problem is that every time a user comes in or if I restart the server it gets a new socket.id. Plus I can't save the whole socket into memory because it gives me a [Circular JSON] problem. How do I save…
Ridan
  • 319
  • 2
  • 14
2
votes
1 answer

socket.io - passing events between nodes

I was inspired by this: http://socket.io/docs/using-multiple-nodes/#passing-events-between-nodes, and right now I want to synchronize my two socket.io instances through the redis adpter. This is my code: //FIRST SERVER (server1.js) var io =…
moskrc
  • 1,220
  • 1
  • 12
  • 23
1
vote
1 answer

Unable to send socket.io event using @socket.io/redis-emitter to server which is using @socket.io/redis-adapter internally

I have copy pasted code from documentation. Still server is not able to receive events from emitter. server.js const { Server, Socket } = require("socket.io"); const { createClient } = require("redis"); const { createAdapter } =…
1
vote
0 answers

Server to Server events in Socket.io

I'm using Socket.io with Redis Adapter in GKE where I have two replicas of socket server I want to create something scale able that's why I'm using redis pub/sub but I also need to listen when something happen in other replica, is it possible to…
Azeem Haider
  • 1,443
  • 4
  • 23
  • 41
1
vote
0 answers

How long can a ioredis connection be re-used

I am using ioredis to create a redis client in Node for an appservice that is deployed in Azure. The code looks something like this, enter image description here I am creating one connection per instance which will live forever until there is a…
1
vote
1 answer

What is the difference between Socket.io Redis adapter and Redis emitter

While I'm reading this article from the Socket.io documentation I found that the following two packages @socket.io/redis-adapter and @socket.io/redis-emitter are used to emit data to the clients that are on the other servers. Are these two packages…
Amjed Omar
  • 853
  • 2
  • 14
  • 30
1
vote
0 answers

How to use the postgres-adapter in Socket.io in node.js

My current setup is as such: I have connected to my postgres database and i also have the websocket connected fine to the frontend. But I am not sure how to use the postgres-adapter as its suggested in the documentation: They say that you make a…
x..
  • 13
  • 1
  • 3