Skip to content
This repository was archived by the owner on Sep 27, 2021. It is now read-only.

Conversation

@Ruby184
Copy link

@Ruby184 Ruby184 commented Jul 23, 2018

Proposed changes

When I was playing with the cluster to implement PM2 support I realized that when using Socket.emitTo method, payload is sent to specified socket ids on current worker, but then broadcasted to other cluster workers and sent to all sockets - filtering of ids is not preserved. So I added these arguments to message broacasted by ClusterHop. Also I added an ability to specify ids ommited by broadcast. Examle:

// broacast to all sockets except the current one (socket.id)
socket.broadcast('event', 'data')
// broadcast to all except sockets with ids "id1" and "id2"
socket.broadcast('event', 'data', ['id1', 'id2'])
// also when using channel
channel.topic('topic').broadcast('event', 'data', ['id1', 'id2'])

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have read the CONTRIBUTING doc
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

Further comments

I will add tests just tell me if you are OK with the changes made. Thank you.

@coveralls
Copy link

coveralls commented Jul 23, 2018

Coverage Status

Coverage decreased (-0.2%) to 93.484% when pulling 14d8696 on Ruby184:broadcast-fix into 27143fd on adonisjs:develop.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants