#pubsub #server #publish #subscribe

app stetson

A pure rust pubsub server over HTTP websockets

2 releases

0.1.1 Mar 30, 2023
0.1.0 Mar 30, 2023

#204 in WebSocket

MIT license

18KB
324 lines

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

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

Requests

subscribe

{ "subscribe": { "topics": ["sports", "weather"] } }

unsubscribe

{ "unsubscribe": { "topics": ["sports"] } }

publish

{ "publish": { "topics": ["weather"], "message": "storms ahead", "key": "..." } }

Responses

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" } }

License

Licensed under either of

Dependencies

~16MB
~283K SLoC