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

Multiplex ws allow duplicate messages to be filtered #318

Merged
merged 6 commits into from
Jun 30, 2016

Conversation

AdamMagaluk
Copy link
Collaborator

@AdamMagaluk AdamMagaluk commented Jun 20, 2016

Adds filterMultiple query parameter to multiplexed ws. If filterMultiple is set as a query parameter on WS /events then all events that fulfill multiple subscriptions will only be sent once to the client. The subscriptionId will always be an array of subscriptions it fulfills.

Eg.

Without filterMultiple subscribing to ** and */photocell/*/intensity

λ: wsta ws://localhost:1337/events '{"type": "subscribe", "topic": "**"}' '{"type": "subscribe", "topic": "*/photocell/*/intensity"}'
Connected to ws://localhost:1337/events
{"type":"subscribe-ack","timestamp":1467138805442,"topic":"**","subscriptionId":1}
{"type":"subscribe-ack","timestamp":1467138805442,"topic":"*/photocell/*/intensity","subscriptionId":2}
{"type":"event","topic":"milford/photocell/e7ffb5e3-6961-4d03-8eca-e4267c49af5a/intensity","timestamp":1467138805468,"subscriptionId":1,"data":1.258819045102531}
{"type":"event","topic":"milford/photocell/e7ffb5e3-6961-4d03-8eca-e4267c49af5a/intensity","timestamp":1467138805468,"subscriptionId":2,"data":1.258819045102531}

With filterMultiple subscribing to ** and */photocell/*/intensity

λ: wsta ws://localhost:1337/events?filterMultiple=true '{"type": "subscribe", "topic": "**"}' '{"type": "subscribe", "topic": "*/photocell/*/intensity"}'
Connected to ws://localhost:1337/events?filterMultiple=true
{"type":"subscribe-ack","timestamp":1467138861241,"topic":"**","subscriptionId":1}
{"type":"subscribe-ack","timestamp":1467138861242,"topic":"*/photocell/*/intensity","subscriptionId":2}
{"type":"event","topic":"milford/photocell/e7ffb5e3-6961-4d03-8eca-e4267c49af5a/intensity","timestamp":1467138861259,"subscriptionId":[1,2],"data":0.9999999999999961}

Also includes fixes to allow device queries on remote peers to work over multiplexed ws.

Device queries come in the format {serverName}/query/{query string}

@mdobson
Copy link
Contributor

mdobson commented Jun 28, 2016

+1

@mdobson
Copy link
Contributor

mdobson commented Jun 30, 2016

+2

@AdamMagaluk AdamMagaluk changed the title WIP: Multiplex ws filter duplicates Multiplex ws allow duplicate messages to be filtered Jun 30, 2016
@AdamMagaluk AdamMagaluk merged commit 0f817fc into master Jun 30, 2016
@AdamMagaluk AdamMagaluk deleted the multiplex-ws-filter-duplicates branch June 30, 2016 13:39
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.

2 participants