question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"phx_join" is never sent if socket is not open by the time `Join` is called

See original GitHub issue

Creating 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
arne-schroppecommented, Apr 4, 2022

@Mazyod I’ll have a look and write my feedback in the PR. And thanks for spending time on fixing this!

1reaction
Mazyodcommented, Feb 28, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found