https://github.com/rcdexta/torpedo
Websockets Orchestrator
https://github.com/rcdexta/torpedo
Last synced: about 1 month ago
JSON representation
Websockets Orchestrator
- Host: GitHub
- URL: https://github.com/rcdexta/torpedo
- Owner: rcdexta
- Created: 2016-05-28T15:27:32.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-04-07T16:50:35.000Z (about 9 years ago)
- Last Synced: 2025-01-26T08:45:25.056Z (over 1 year ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Torpedo
Torpedo is a generic pass-through websockets server based on socket.io.
## Connecting and receiving messages from Torpedo
The following example uses socket.io javascript client - https://github.com/automattic/socket.io-client
```
var namespace = '/test';
var event = 'NEW_NOTIF';
var torpedoUrl = 'https://torpedo-staging.pro.com'
var socket = io(torpedoUrl + namespace);
socket.on(event, function(data) {
console.log(data);
});
```
## Broadcasting messages to torpedo clients
Torpedo exposes an api endpoint '/notify' to which messages can be sent as POST requests.
Following is the expected format of the request:
```
POST '/notify'
{
"namespace":"cooper",
"event":"NEW_NOTIF",
"payload":{
...
}
}
```
Any content within the payload will be sent to connected clients without any modifications.