Skip to content

xi/via

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Via - Simple pubsub server

This is very much inspired by https://patchbay.pub/ and its clones conduit and 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 somedata

Use 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 PUT

You 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  # 200

You 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
  • support for passwords
  • support for message history

About

Simple pubsub server inspired by https://patchbay.pub/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published