Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(router): socket emits with specified receivers misbehaving #109

Merged
merged 1 commit into from
Apr 3, 2022

Conversation

kon14
Copy link
Contributor

@kon14 kon14 commented Apr 3, 2022

Fixes socket emits for specified rooms not behaving as expected.

Previously, we'd have every socket in target namespace emitting events received by every other socket in the specified room/s.
This results in multiple unexpected side-effects, where single socket connections never receive data (as there's no other socket to forward it to them), connections of 3+ sockets possibly resulting in data being emitted multiple times from different sockets etc.

This change effectively makes it so that:

  1. Every socket push successfully sends data to every single socket that:
  • is connected in the same namespace
  • is listening on the particular event
  • has joined the socket room the data is intended for
  1. Data generated through gRPC (eg Chat.sendMessage) reaches every socket matching the above criteria, but data sent over from a socket client is not "received" from that very socket.
    Meaning you (the socket) won't see your own sent data as "incoming".
  2. Socket emits work consistently regardless of how many sockets are currently connected.

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

The PR fulfills these requirements:

  • It's submitted to the main branch
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx, where "xxx" is the issue number)

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

This fix should also get backported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants