(copy paste from github too + tests done and works like a charm)

Hi, thanks for your answer.

Oh yes I missed handle_open. This makes sense, thank you very much.

Actually I don't want to send messages trough the socket at initialisation. I just subscribe to pubsub updates. So when there is an update, handle_info will receive it and forward the message via the socket. I've just "faked" (??)  this process on my example code.

Cheers


Le 29/08/2014 14:42, Christopher Faulet a écrit :

Hi,

This is a copy paste of my reply on Github:

Yes, that is normal. When the process is started, the connection was not
yet upgraded from HTTP to WebSocket. You should not try to send data
before the handshake is finished. You could implement handle_open/2
callback in your module to be notified when the connection is upgraded.
Note also that you could send data using
yaws_api:websocket_send(WSState, Messages) directly from your
handle_open/2 callback. In your case, this will be easier than sending
custom message to fallback in handle_info/2.



------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/


_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list