8000 GitHub - alvivar/atomsub: Simple PubSub Server in Rust. It uses Polling from smol in the main thread to detect connections, read and write. It handles subscriptions in another thread.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Simple PubSub Server in Rust. It uses Polling from smol in the main thread to detect connections, read and write. It handles subscriptions in another thread.

Notifications You must be signed in to change notification settings

alvivar/atomsub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

atomsub

Simple PubSub Server in Rust.

It uses Polling from smol in the main thread to detect connections, read and write. It handles subscriptions in another thread.

How it works

To subscribe, send a message starting with +, the first word after + will be used as the channel to be subscribed.

$ +somechannel

If you send more words, those will be considered a first message.

$ +somechannel Subscribed and a first message!

To send a message without subscribing, use :

$ :somechannel Some message to all somechannel subscribers.

To unsubscribe use -

$ -somechannel

It's also possible to send a last message while unsubscribing:

$ -somechannel And a last message.

When you are subscribed to a channel, you also receive the key in the first word of the message. This way clients can react properly.

$ somechannel Some message to this channel.

Try it

With Rust installed, just run:

cargo run

In unix consoles you can connect with nc as client:

$ nc 127.0.0.1 1984

But any TcpStream stream from your favorite language will do.

About

Simple PubSub Server in Rust. It uses Polling from smol in the main thread to detect connections, read and write. It handles subscriptions in another thread.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

0