NFIBrokerage / slipstream

A slick WebSocket client for Phoenix Channels
https://hex.pm/packages/slipstream
Apache License 2.0
155 stars 18 forks source link

Server (Phoenix Channels) sending binary data to clients (Slipstream) #60

Closed CJRChang closed 8 months ago

CJRChang commented 8 months ago

I'm trying to send some binary data from the server (Phoenix Channels) to the client, running Slipstream.

On the server side, this is something like:

AppWeb.Endpoint.broadcast!("channel", "topic", {:binary, binary_data})

which should invoke handle_message on SlipStream side.

Instead this seems to be invoking handle_info/2 with the following parameters:

#1 nil
#2 state

It looks like the client side stack trace is something like:

deps/slipstream/lib/slipstream.ex:83: ClientApp.Websocket.handle_info/2
lib/slipstream/callback.ex:34
CJRChang commented 8 months ago

On further investigation, discovered this seems to work for push/3 and not broadcast/3.

the-mikedavis commented 8 months ago

Could you give https://github.com/NFIBrokerage/slipstream/pull/61 a try? I believe all we're missing is a function clause to deserialize binary broadcast messages.

CJRChang commented 8 months ago

That seems to work now - thanks!

the-mikedavis commented 8 months ago

Thanks for checking! This is released now as v1.1.1