Crates.io | stetson |
lib.rs | stetson |
version | 0.1.1 |
source | src |
created_at | 2023-03-30 00:26:52.900194 |
updated_at | 2023-03-30 02:43:50.509606 |
description | A pure rust pubsub server over HTTP websockets. |
homepage | |
repository | https://github.com/hexcowboy/stetson |
max_upload_size | |
id | 824536 |
size | 57,548 |
Stetson is a pure rust pubsub server over HTTP websockets.
Use it vanilla or fork it and make your own modifications.
Install the binary
cargo install stetson
Run the server, making sure to set a publisher key
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
cat .env
subscribe
{ "subscribe": { "topics": ["sports", "weather"] } }
unsubscribe
{ "unsubscribe": { "topics": ["sports"] } }
publish
{ "publish": { "topics": ["weather"], "message": "storms ahead", "key": "..." } }
message
- received when a new message from a subscribed topic is received
{ "message": { "topic": "weather", "message": "storms ahead" } }
error
- received when there was en error publishing a message
{ "error": { "message": "some error message here" } }
Licensed under either of