Add WebSocket event stream for REST clients - #2
Open
peerchemist wants to merge 26 commits into
Open
Conversation
…server into ws # Conflicts: # Dockerfile # bin/grpc_server.dart # lib/src/config/grpc.dart # lib/src/grpc.dart # lib/src/server/api_handler.dart # lib/src/server/state/state.dart # test/client_test.dart # test/config_test.dart # test/grpc_test.dart # test/server/api_handler_test.dart
MatthewLM
reviewed
Jun 19, 2026
MatthewLM
left a comment
Collaborator
There was a problem hiding this comment.
Only skimmed through it. I can't thoroughly review all the new REST stuff.
|
|
||
| ServerState() { | ||
| ServerState({ | ||
| Logger? logger, |
Collaborator
There was a problem hiding this comment.
Doesn't need to be nullable?
| void sendEventToAll(Event e, {List<SessionID> exclude = const []}) { | ||
| for (final session in clientSessions.values) { | ||
| if (!exclude.contains(session.sessionID)) session.sendEvent(e); | ||
| final sessions = clientSessions.values.toList(); |
Collaborator
There was a problem hiding this comment.
toList() appears unnecessary. List is created for recipients on next line. Probably best to do:
final recipients = clientSessions
.values
.where((session) => !exclude.contains(session.sessionID))
.toList();
| logger: logger ?? createNoosphereRoastServerLogger(), | ||
| ); | ||
|
|
||
| ServerApiHandler._({ |
Collaborator
There was a problem hiding this comment.
Don't see why a new _ constructor is required? Can't Logger be set similar to state?
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.
Adds a WebSocket event stream for browser REST clients. Event messages are sent as JSON text frames with explicit type names and base64-encoded event bytes: