"phx_join" is never sent if socket is not open by the time `Join` is called
See original GitHub issueCreating a channel and immediately joining it will cause the “phx_join” message to be stuck in Channel
’s sendBuffer forever, if the underlying WebSocket is not open by the time Join
is called.
Example code:
var fooChannel = _socket.MakeChannel("foo");
fooChannel.Join(new Dictionary<string, object>(), _timeout)
The second line will eventually call Socket.Push(Message)
. That method will check if the channel’s socket is already in state Open
. If it isn’t, it will return false
which will cause its calling method, Channel.Push(Push, TimeSpan?)
, to add the “phx_join” message to its sendBuffer
. But FlushSendBuffer
is only called in OnJoinReply
. So it can’t ever be sent and the channel will never be joined.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Mazyod I’ll have a look and write my feedback in the PR. And thanks for spending time on fixing this!
I haven’t revisited the reference Phoenix client implementation in a while… but it seems the
sendBuffer
is now the responsibility of the socket object, which makes more sense.I’ll look into revising the implementation and updating it to be consistent with the reference implementation from the official phoenix framework repository.
Once that’s done, I’ll add a test case with your scenario and hope it will simply pass 😃
https://github.com/phoenixframework/phoenix/blob/master/assets/js/phoenix/socket.js#L94