https://github.com/casey/floodhub
A simple websocket server for heroku
https://github.com/casey/floodhub
Last synced: 8 months ago
JSON representation
A simple websocket server for heroku
- Host: GitHub
- URL: https://github.com/casey/floodhub
- Owner: casey
- Created: 2016-07-12T23:41:09.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-13T20:25:30.000Z (almost 10 years ago)
- Last Synced: 2025-02-14T01:18:24.952Z (over 1 year ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
floodhub
--------
A simple websocket server.
Messages sent by clients should be JSON strings that deserialize to objects with the following fields:
`namespace`: The message namespace.
`data`: The message payload.
`type`: A string identifying the type of the message.
`to`: A numeric ID will cause the message to be delivered
to the client with that ID. The string "all" will
cause the message to be delivered to all connected
clients.
The server will add a `from` field set to the numeric ID of the
originating client. The server assigns IDs to each client that
connects, starting at 0.
Namespaces are not handled specially by the server, and are
there so multiple apps can ignore each other's messages.
For example, the following message sent by client 0:
```
{
"namespace": "something-cool",
"type": "hello",
"data": [1,2,3],
"to": "all"
}
```
Will be transmitted to all clients as:
```
{
"namespace": "something-cool",
"type": "hello",
"data": [1,2,3],
"to": "all",
"from": 0
}
```
The following message sent by client 1:
```
{
"namespace": "something-cool",
"type": "goodbye",
"data": [1,2,3],
"to": 3
}
```
Will be transmitted to client 3 as:
```
{
"namespace": "something-cool",
"type": "goodbye",
"data": [1,2,3],
"to": 3,
"from": 1
}
```