Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xi/via
Simple pubsub server inspired by https://patchbay.pub/
https://github.com/xi/via
Last synced: about 1 month ago
JSON representation
Simple pubsub server inspired by https://patchbay.pub/
- Host: GitHub
- URL: https://github.com/xi/via
- Owner: xi
- License: mit
- Created: 2020-04-04T06:35:00.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-02-12T09:00:04.000Z (11 months ago)
- Last Synced: 2024-06-21T17:55:27.953Z (7 months ago)
- Language: Go
- Size: 33.2 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Via - Simple pubsub server
This is very much inspired by and its clones
[conduit](https://github.com/prologic/conduit) and
[duct](https://github.com/schollz/duct).## Usage
Start the server:
via [-v] [-d storage_dir] [port]
Then start sending requests on the client:
# start listening for server sent event stream
curl http://localhost:8001/msg/someid# POST a message
curl http://localhost:8001/msg/someid -d somedataUse the `hmsg` prefix if you want to keep a history:
# start listening and request any messages you may have missed
curl http://localhost:8001/hmsg/someid -H 'Last-Event-Id: 3'# POST works just as before
curl http://localhost:8001/hmsg/someid -d somedata# DELETE deletes the history
curl http://localhost:8001/hmsg/someid -X DELETE# the history only keeps up to 100 entries.
# you can optimize it by replacing all entries by a single message
curl http://localhost:8001/hmsg/someid -d combined -H 'Last-Event-Id: 3' -X PUTYou can also protect your ID with a password so no one else can listen to
it at the same time:curl http://localhost:8001/msg/someid:somepassword
curl http://localhost:8001/msg/someid # 403
curl http://localhost:8001/msg/someid -d somedata # 200You should regularly clean up old files:
find {storage_dir} -type f -mtime +7 -delete
## Differences to patchbay
- no support for MPMC (blocking POST)
- no support for req/res
- no support for blocking GET
- support for [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events)
- support for passwords
- support for message history