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

Feature/subscription handling #230

Merged
merged 28 commits into from
May 17, 2018
Merged

Conversation

blondejamtart
Copy link
Contributor

Fixed cancelling subscription of wrong client if another loses connection, also added checks to prevent duplicate subscription IDs on a single client.

Bryan Robert Tester and others added 26 commits April 25, 2018 11:28
Added return error messages to client following errors in websocket comms
Also fixed test requirements.
Tweaked error messages for various components called in WebsocketHandler
to improve readability and added to unit tests
Temporarily disabled some tests which were being troublesome on Travis
Gone back to str(error) instead of error.message for compatibility reasons,
also implemented "FieldError" class to replace KeyError
for better behaviour with the above
Added different expected results for python3 (with version check)
for some WebsocketHandler error cases
Attempt to correct inconsistent behaviour of OrderedDict.keys()
between python versions
Also added extra test for superfluous params in message
Was throwing error on all requests without path,
which broke unsubscribing among other things.
Now only throws on PathRequest without path
subscribtion_keys on serverpart now indexed by hash of callback + path
instead of message id
@@ -2,7 +2,8 @@
from tornado.websocket import WebSocketHandler, WebSocketError

from malcolm.core import Part, json_decode, deserialize_object, Request, \
json_encode, Subscribe, Unsubscribe, Delta, Update, Error, UnexpectedError
json_encode, Subscribe, Unsubscribe, Delta, Update, Error, Response
from malcolm.core.request import PathRequest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put PathRequest and FieldError in malcolm.core.init and import from there please

self.log.info("Request: %s", request)
if isinstance(request, Subscribe):
if request.generate_key() in self._subscription_keys.keys():
raise Exception("duplicate subscription ID on client")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use KeyError?

@thomascobb thomascobb merged commit 83ed432 into annotypes May 17, 2018
@thomascobb thomascobb deleted the feature/SubscriptionHandling branch May 17, 2018 11:08
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