Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hexcowboy/stetson
A pure rust pubsub server
https://github.com/hexcowboy/stetson
publish-subscribe pubsub rust server websockets
Last synced: 3 days ago
JSON representation
A pure rust pubsub server
- Host: GitHub
- URL: https://github.com/hexcowboy/stetson
- Owner: hexcowboy
- License: apache-2.0
- Created: 2023-03-29T21:45:45.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-02T20:42:37.000Z (10 months ago)
- Last Synced: 2024-10-13T08:44:11.921Z (about 1 month ago)
- Topics: publish-subscribe, pubsub, rust, server, websockets
- Language: Rust
- Homepage:
- Size: 188 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
Stetson
Stetson is a pure rust pubsub server over HTTP websockets.
Use it vanilla or fork it and make your own modifications.## Usage
Install the binary
```bash
cargo install stetson
```Run the server, making sure to set a publisher key
```bash
echo "PUBLISH_KEY=$(openssl rand -hex 24)" > .env ; stetson
```You can find the publisher key that was generated in the previous step in the `.env` file
```bash
cat .env
```### Requests
`subscribe`
```json
{ "subscribe": { "topics": ["sports", "weather"] } }
````unsubscribe`
```json
{ "unsubscribe": { "topics": ["sports"] } }
````publish`
```json
{ "publish": { "topics": ["weather"], "message": "storms ahead", "key": "..." } }
```### Responses
`message` - received when a new message from a subscribed topic is received
```json
{ "message": { "topic": "weather", "message": "storms ahead" } }
````error` - received when there was en error publishing a message
```json
{ "error": { "message": "some error message here" } }
```## License
Licensed under either of
* Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)