Conversation
sgfn
reviewed
Sep 26, 2023
Member
sgfn
left a comment
There was a problem hiding this comment.
Looks good -- I'm not too familiar with the notifications flow, but as far as I can tell, everything is as it should be. A couple nitpicks only
LVala
approved these changes
Sep 27, 2023
README.md
Outdated
| ``` | ||
|
|
||
| You can use it to interact with Jellyfish managing rooms, peers and components | ||
| You can use it to interact with Jellyfish, managing rooms, peers and components |
There was a problem hiding this comment.
Suggested change
| You can use it to interact with Jellyfish, managing rooms, peers and components | |
| You can use it to interact with Jellyfish, manage rooms, peers and components |
or ...Jellyfish, enabling the management of rooms..., now it sounds kinda weird.
jellyfish/_notifier.py
Outdated
Comment on lines
+61
to
+62
| async with client.connect(f'ws://{self._server_address}/socket/server/websocket') \ | ||
| as websocket: |
There was a problem hiding this comment.
Nitpick, but I don't like the line break
Suggested change
| async with client.connect(f'ws://{self._server_address}/socket/server/websocket') \ | |
| as websocket: | |
| address = f'ws://{self._server_address}/socket/server/websocket' | |
| async with client.connect(address) as websocket: |
Comment on lines
+67
to
+72
| if self._notification_handler: | ||
| await self._subscribe_event( | ||
| event=ServerMessageEventType.EVENT_TYPE_SERVER_NOTIFICATION) | ||
|
|
||
| if self._metrics_handler: | ||
| await self._subscribe_event(event=ServerMessageEventType.EVENT_TYPE_METRICS) |
There was a problem hiding this comment.
Does that mean that you cannot add handler after you have been connected? If so, I would mention it somewhere.
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.
Implemented Server Notifications using websockets and asyncio.
I recommend taking a look at the example in the Readme first.
The notification handling occurs as following:
on_server_notificationandon_metricsdecorators. Now the Notifier has designated handler for the given message types.If you are unfamiliar with asyncio, I recommend taking a look at their docs, for example here: https://docs.python.org/3/library/asyncio-task.html
INB4: I plan to add
secureoption to both RoomApi and Notifier but not in this PR