Add support for sending messages to external clients#273
Open
Add support for sending messages to external clients#273
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for sending messages to external clients by refactoring the message handling system to use state-based targeting instead of project/role-based targeting. The changes enable services to send messages to clients that don't have traditional room/role concepts.
- Modified message targeting to use client state instead of project/role IDs
- Updated RemoteClient constructor to accept state parameter
- Added state information to service context for external client support
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/remote-client.js | Updated constructor to accept state parameter and modified message sending to use state-based targeting |
| src/procedures/alexa/skill.js | Updated RemoteClient instantiation to pass state instead of individual project/role IDs |
| src/messages.js | Refactored SendMessageToClient to accept state directly and added documentation |
| src/api.js | Added state to service context and updated RemoteClient instantiation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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 adds support for external clients wrt messages originating from services. However, some services require the room/role concept which is not supported by external clients. These will still not receive messages.
At a high level, the message sending API on the cloud supports sending the client state. If the client's state has changed by the time the message is sent, the message will be dropped. Currently, it assumes every client is a browser client. This is problematic bc that means the NetsBlox cloud will drop every message for external clients.
This PR updates this logic to simply pass the state received from the client along to the NetsBlox cloud - rather than reconstruct it (incorrectly).
Note: This hasn't been tested.