[y-partyserver] Provider sends other clients' awareness back to the server
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- backend
Línea de trabajo
Empieza por _awarenessUpdateHandler en YProvider, el manejador de cambios de awareness que envía un mensaje en cada cambio, y por el manejador de mensajes de awareness que aplica las actualizaciones del servidor usando el provider como origin. Añade un retorno anticipado cuando el origin sea el provider, para que un cliente no vuelva a enviar actualizaciones que recibió del servidor. Está terminado cuando un movimiento del cursor en una pestaña envía un frame en lugar de N, y los cursores remotos siguen mostrándose en las demás pestañas. Una prueba que compruebe que el manejador omite las actualizaciones con origin del servidor lo demostraría.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happens
YProvider's awareness handler sends a message on every awareness change, whatever its origin:
this._awarenessUpdateHandler = ({ added, updated, removed }, _origin) => { /* … */ broadcastMessage(/* … */) };
Awareness updates from the server are applied with the provider as origin (applyAwarenessUpdate(provider.awareness, …, provider) in the awareness message handler), so each client sends every other client's change straight back. YServer already relays every awareness message to all connections, so with N clients one cursor move costs the server N incoming frames instead of 1. On Durable Objects each of them is an invocation: a billed request, and a log event when Workers Logs is on.
Measured
y-partyserver 2.2.0 (the handler is the same on main), 3 Chromium tabs on one document, frames counted by wrapping WebSocket.prototype.send:
| Now | With the fix below | |
|---|---|---|
| Cursor move (arrow key) in one tab | 3 frames | 1 |
| Keystroke, with Tiptap's CollaborationCaret | 10 | 4 (2 with ueberdosis/y-tiptap#55 fixed too) |
Remote cursors still render in every tab with the fix.
Suggested fix
this._awarenessUpdateHandler = ({ added, updated, removed }, origin) => {
if (origin === this) return; // from the server, which has already relayed it to everyone
// …
};
Every client only needs to receive each awareness update once; re-sending is allowed but not needed (Yjs's author on the same y-websocket behaviour: https://discuss.yjs.dev/t/redundant-messages/1062). Happy to open a PR with a test.
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.3k
- Forks
- 83
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la 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 cloudflare/partykit
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
cloudflare/partykit#425 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
cloudflare/partykit#423 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
cloudflare/partykit#419 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
cloudflare/partykit#411 ·
-
[y-partyserver] provider.destroy() leaks reconnect timer, hanging Node processes and delaying GCAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
cloudflare/partykit#402 · 1 comentario ·
Todos los issues de cloudflare/partykit
Issues similares
-
New icon: `filter-clear`Abiertocalcite-ui-icons enhancement impact - p3 - not time sensitive needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Esri/calcite-design-system#15467 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
diegosouzapw/OmniRoute#18390 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 86/100
guilhermerodz/input-otp#157 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
davidjerleke/embla-carousel#1414 ·
Los mantenedores suelen responder en 4 días