slact / nchan.js

NPM package for the Javasript client for Nchan
Other
91 stars 25 forks source link

Listener fails on blob. #15

Closed disarticulate closed 6 years ago

disarticulate commented 6 years ago

application/octet-stream are transmitted as binary blobs

also note:

slact commented 6 years ago

This is the intended behavior:

Messages are delivered to subscribers in text websocket frames, except if a message's content-type is "application/octet-stream" -- then it is delivered in a binary frame.

see https://nchan.io/#websocket

disarticulate commented 6 years ago

The intention is not to process blobs?

On Sat, Mar 31, 2018, 7:53 PM slact notifications@github.com wrote:

This is the intended behavior:

Messages are delivered to subscribers in text websocket frames, except if a message's content-type is "application/octet-stream" -- then it is delivered in a binary frame.

see https://nchan.io/#websocket

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/slact/nchan.js/pull/15#issuecomment-377734385, or mute the thread https://github.com/notifications/unsubscribe-auth/AQp7PeuSiT8BbpfgUtlFnrkZAIr-pt4Cks5tkCUlgaJpZM4TCf5G .

slact commented 6 years ago

err, the content-type behavior is as intended.

Your Blob fix was the right approach, but it needed a little more massaging. Thanks for the PR, i'll release this version on npm in a few days.

disarticulate commented 6 years ago

I guess my point was that you can't send binary frames via the websocket. I was aware that you can send binary data to the POST channel.

Is there a technical reason not to let websockets send binary messages?

slact commented 6 years ago

You can send binary frames via websocket by adding add_header "Content-Type" "application/octet-stream"; to your nginx publisher location. There is no way to conditionally send binary blobs over websocket for a given URL.