Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kevoree/kevoree-js-comp-wsmsgbroker
A Kevoree component that starts a WSMsgBroker server
https://github.com/kevoree/kevoree-js-comp-wsmsgbroker
Last synced: about 2 months ago
JSON representation
A Kevoree component that starts a WSMsgBroker server
- Host: GitHub
- URL: https://github.com/kevoree/kevoree-js-comp-wsmsgbroker
- Owner: kevoree
- License: lgpl-3.0
- Created: 2015-03-26T11:31:56.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-26T11:39:22.000Z (almost 10 years ago)
- Last Synced: 2024-04-10T22:30:19.045Z (10 months ago)
- Language: JavaScript
- Size: 133 KB
- Stars: 0
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## kevoree-comp-wsmsgbroker
Starts a WebSocket server using dictionary attributes `port` & `port`
### Usage
Add `WSMsgBroker` into a `JavascriptNode`, then set its `port` & `path` (optional) attributes.
Deploy your model, and that's it! You have a running WebSocket server listening on `0.0.0.0:/`### Protocol
The server expects received messages to be JSON-encoded and to respect this protocol:
- register: Register a new client
```json
{
"action": "register",
"id": "YOUR_CLIENT_ID"
}
```
> The uniqueness of the `IDs` must be handled by the clients otherwise the server will just replace the old client-id.
- send: Send a message to a client (or multiple clients)
```json
{
"action": "send",
"dest": "SOME_CLIENT_ID",
"message": "some message"
}
```
or
```json
{
"action": "send",
"dest": ["CLIENT_ID0", "CLIENT_ID1", "CLIENT_ID2"],
"message": "some message"
}
```
> `msg.dest` can be a `string` or an `array` of strings