Adding Websockets#54
Merged
jhjaggars merged 9 commits intoproject-receptor:masterfrom Dec 5, 2019
Merged
Conversation
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
matburt
approved these changes
Dec 5, 2019
Member
matburt
left a comment
There was a problem hiding this comment.
This is really just some logging nitpicking.
| except Exception as e: | ||
| logger.error("An error occured while running receptor:\n%s" % (str(e),)) | ||
| except Exception: | ||
| logger.exception("main: an error occured while running receptor") |
Member
Author
There was a problem hiding this comment.
The reason will be in the stack trace (which I found more helpful), but it is longer.
Signed-off-by: Jesse Jaggars <jjaggars@redhat.com>
|
|
||
| class WSClient(WSBase): | ||
| async def connect(self, uri): | ||
| async with aiohttp.ClientSession().ws_connect(uri) as ws: |
There was a problem hiding this comment.
Tower just started using aiohttp. You probably want to get a handle on that session and call await session.close() or use a context manager to handle the closing or prepared to be peppered with logger messages Unclosed client session
| self.unregister(ws) | ||
| await asyncio.sleep(5) | ||
| logger.debug("connect: reconnecting") | ||
| self.loop.create_task(self.connect(uri)) |
There was a problem hiding this comment.
I totally stole this recursive reconnect hotness.
This file contains hidden or 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
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.
This PR introduces WebSocket support for connections.
Currently when you start a node in listening mode a WebSocket server is also started on port+1. Peers can be added by appending ws[s]:// to the front of the address.