-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
…malcolm into WebSocket-ErrorReporting
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
…ature/SubscriptionHandling
thomascobb
suggested changes
May 17, 2018
@@ -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 |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use KeyError?
thomascobb
approved these changes
May 17, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed cancelling subscription of wrong client if another loses connection, also added checks to prevent duplicate subscription IDs on a single client.