Redis Adapter emits message twice
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, redis
- Ambito
- backend, distributed-systems
Direzione di ricerca
Start by running the reproduction code in the issue with Redis enabled and then disabled, comparing how many times client-2 receives the member:message event and how the callback responds. The fix is complete when the Redis adapter path delivers the message once while preserving the callback-to-server and callback-to-client-1 flow.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
When I use callbacks and I follow this pattern client-1 -> server -> client-2 -> callback-to-server -> callback-to-client-1 the adapter appears to send messages twice to client-2. Here is replication code. When I comment out all redis things it will only send once
Server
`const socketIo = require("socket.io");
const redisAdapter = require("@socket.io/redis-adapter");
const redis = require("redis");
const io = new socketIo.Server(
{
cors: {
origin: process.env.ORIGIN,
methods: ["GET", "POST"],
credentials: true,
},
}
);
let ns = io.of('/');
const pubClient = redis.createClient({ url: "redisurl" });
const subClient = pubClient.duplicate();
Promise.all([pubClient.connect(), subClient.connect()]).then(() => {
io.adapter(redisAdapter.createAdapter(pubClient, subClient));
io.listen(PORT);
});
pubClient.on('connect', () => {
console.log('::> Redis Client Connected');
});
pubClient.on('error', (err) => {
console.log('<:: Redis Client Error', err);
});
ns.on("connection", async (socket) => {
socket.on("host:broadcast", async (data, callback) => {
const room = socket.to(data.room);
room.emit("member:message", data, (arg) => {
callback(arg);
});
});
});
`
- Lingua principale
- TypeScript
- Stelle
- 2.8k
- Fork
- 485
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di socketio/socket.io-redis-adapter
-
question
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
socketio/socket.io-redis-adapter#574 · 1 commento ·
-
io.fetchSockets() fails with createSentinelForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
socketio/socket.io-redis-adapter#573 · 1 commento ·
-
`hasBinary()` throws `RangeError: Maximum call stack size exceeded` on Mongoose documents, silently dropping events in sharded modeForse già presa @junsj119 l’ha presa 96 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
socketio/socket.io-redis-adapter#561 · 1 commento ·
Tutte le issue di socketio/socket.io-redis-adapter
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
outline/outline#14529 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 86/100
g1331/phantom-circuit#93 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
compiler
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
HerringtonDarkholme/hd-lang#1699 ·
I maintainer di solito rispondono entro 1 giorno