Binary pushes don't work over the LongPoll transport
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- elixir, javascript
- Ambito
- backend
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Elixir
- Stelle
- 23.2k
- Fork
- 3.2k
- Merge medio
- 16h 35m
- PR unite (30g)
- 18
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la 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 phoenixframework/phoenix
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 56/100
phoenixframework/phoenix#6898 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
~p treats routes as static when they only start with a static directory nameForse già presa @mandar1045 l’ha presa 12 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
phoenixframework/phoenix#6895 ·
I maintainer di solito rispondono entro 1 giorno
-
Connection: close header not sent before closing HTTP 1.1 connection when a controller raises an exceptionForse già presa @javiergarea l’ha presa 41 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
phoenixframework/phoenix#6859 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
phoenixframework/phoenix#6853 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
LongPoll session tokens are not bound to the mount path or socket handlerForse già presa @SteffenDE l’ha presa 86 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
phoenixframework/phoenix#6791 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di phoenixframework/phoenix
Issue simili
-
Bug: Table layout and date column are cut off on mobile screens on the Tournaments -> History pageApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
hexlet-codebattle/codebattle#2375 ·
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
wintermeyer/vutuv#2388 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Broadcast API docs say to prepend realtime: to the topic, which breaks deliveryForse già presa @mandar1045 l’ha presa 1 giorno fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
phoenixframework/phoenix_live_view#4509 ·
I maintainer di solito rispondono entro 1 giorno