serverSideEmit(..., callback) does not deliver events until heartbeat is triggered
@Harjot2022 ya está trabajando en esto.
Desde el 22/3/2026.
- #18 de @wangxpych — cerrado sin fusionar
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- postgresql, typescript
- Área
- backend, databases, distributed-systems
Línea de trabajo
Start with the Postgres adapter's serverSideEmit(..., callback) and heartbeat or server discovery flow, using the minimal reproduction in the issue. Compare callback-based emits with emits without callbacks and verify that all connected servers receive the event and return acknowledgements before any dummy emit is sent.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Environment
@socket.io/postgres-adapter: 0.4.0socket.io: 4.8.xpg: 8.16.x- Node.js: 22
- PostgreSQL: 14.x
Problem description
When using serverSideEmit(..., callback), the callback is invoked with:
(err, responses) => {
console.log(err); // null
console.log(responses); // [] ← empty
}
The event is never delivered to any other server, and the handler (io.on(...)) is never triggered on them.
However, if each individual server sends at least one serverSideEmit() (even a dummy one), things start working — the events are delivered and acknowledged as expected.
Note: If
serverSideEmit()is used without a callback, the event is delivered to other servers even before they have sent any emits themselves. The issue only affects the ACK-based communication (serverSideEmit(..., callback)).
Root cause
The Postgres adapter does not deliver serverSideEmit(..., callback) events to other servers unless those servers have already started sending their own heartbeats.
Until a server sends a serverSideEmit():
- It is connected and listening on the correct
LISTENchannel - It can receive broadcast events without callback
- But it will not be discoverable by other servers for ACK-based communication (
serverSideEmit(..., callback))
As a result:
- The initiating server sends a request and waits for ACKs
- But other servers ignore the request because they don't recognize the source as active
- The callback returns with
responses = []
Minimal reproduction
// on all servers:
io.on("test-ack", (data, callback) => {
console.log("received:", data);
callback("ack from " + process.pid);
});
// on emitter server:
setTimeout(() => {
io.serverSideEmit("test-ack", "hello", (err, responses) => {
console.log("err:", err); // null
console.log("responses:", responses); // [] if heartbeat not yet started on other servers
});
}, 1000);
Workaround
Ensure that every server sends a dummy serverSideEmit() after startup to trigger the heartbeat:
io.serverSideEmit("__init__", "poke");
This ensures each server becomes discoverable by others and can participate in ACK-based messaging.
- Lenguaje dominante
- TypeScript
- Estrellas
- 27
- Forks
- 9
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de socketio/socket.io-postgres-adapter
-
Shutting down adapterAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 43/100
socketio/socket.io-postgres-adapter#13 · 4 comentarios · 1 reacción ·
-
question
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
socketio/socket.io-postgres-adapter#12 · 4 comentarios ·
Todos los issues de socketio/socket.io-postgres-adapter
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
NousResearch/hermes-agent#136483 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día
-
Tool errors containing cycles or BigInt crash getErrorMessage and replace the original failureAbiertofactory-active factory-automatic task-bug-reproduction-success task-identify-harness-labels-done task-identify-issue-type-done
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
vercel/ai#22796 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[Bug]: Web chat input doesn't regain focus after a reply finishesPosiblemente ocupada @GaijinSystems la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
zeroclaw-labs/zeroclaw#11658 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
babylonlabs-io/babylon-toolkit#2711 ·
Los mantenedores suelen responder en 1 día