Binary pushes don't work over the LongPoll transport
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- elixir, javascript
- Área
- backend
Línea de trabajo
Start with Phoenix.Transports.LongPoll.Server, where the {:push, ...} and {:reply, ...} clauses drop the frame opcode before buffering, and with the LongPoll client path in longpoll.js that parses the messages list. Run the LongPoll transport tests and add a case that pushes {:binary, <<255,1,2>>} then another message, checking the poll returns both without a 500 and the client parses them. Done means binary server-to-client frames round-trip over LongPoll as they do over WebSocket; note #6907 already proposes a base64 approach, so review it first.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Pushing binary data from a channel doesn't work when the client is on the LongPoll transport.
def handle_info(:send_bin, socket) do
push(socket, "bin", {:binary, <<255, 1, 2>>})
{:noreply, socket}
end
Over WebSocket this works fine. Over LongPoll:
- if the data is not valid UTF-8, the poll request fails with a 500 (
{:invalid_byte, 255}from the JSON encoder), and since the server already cleared its buffer, every other buffered message in that poll is lost too (including the join reply in my test) - if the data happens to be valid UTF-8, the raw binary frame ends up as a string in the
messageslist, e.g."\u0000\u0001\u0006\u00031room:xbinhello", and phoenix.js fails trying toJSON.parseit
Looks like Phoenix.Transports.LongPoll.Server drops the opcode ({:push, {_, reply}, state} / {:reply, status, {_, reply}, state}) and buffers the binary as if it was text. Client to server binary over LongPoll is already handled (base64 encoded, from #5513), but the server to client direction isn't.
One option would be to base64 encode binary frames on the server like the upload path does, and have longpoll.js decode them before handing them to the socket.
- Lenguaje dominante
- Elixir
- Estrellas
- 23.2k
- Forks
- 3.2k
- Merge medio
- 16 h 35 min
- PR fusionados (30 d)
- 18
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 phoenixframework/phoenix
-
Dificultad 3/5 1-2 días Aptitud para principiantes 56/100
phoenixframework/phoenix#6898 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
~p treats routes as static when they only start with a static directory namePosiblemente ocupada @mandar1045 la tomó hace 12 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 30/100
phoenixframework/phoenix#6895 ·
Los mantenedores suelen responder en 1 día
-
Connection: close header not sent before closing HTTP 1.1 connection when a controller raises an exceptionPosiblemente ocupada @javiergarea la tomó hace 41 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
phoenixframework/phoenix#6859 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
phoenixframework/phoenix#6853 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
LongPoll session tokens are not bound to the mount path or socket handlerPosiblemente ocupada @SteffenDE la tomó hace 86 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
phoenixframework/phoenix#6791 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de phoenixframework/phoenix
Issues similares
-
Bug: Table layout and date column are cut off on mobile screens on the Tournaments -> History pageAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
hexlet-codebattle/codebattle#2375 ·
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
wintermeyer/vutuv#2388 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
Broadcast API docs say to prepend realtime: to the topic, which breaks deliveryPosiblemente ocupada @mandar1045 la tomó hace 1 día. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
phoenixframework/phoenix_live_view#4509 ·
Los mantenedores suelen responder en 1 día