'SSE based Pub/Sub Broker
I would like to have an Http based pub/sub server that messages are published to channels with HTTP POST requests, and subscribed through EventSource (SSE). Besides that, I would like to add wildcard subscription capability (check here to know more about it: https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices) similar to MQTT for the SSE broker.
Do you have any suggestions? Is there something similar out there?
Solution 1:[1]
The closest pub/sub using SSE is https://nchan.io/ . Could not be as complete as MQTT but supports not just SSE, also POST/GET, Websockets and even long pooling.
Doesn't seems that wildcard are implemented, but at least you can define several url/query string mappings for a channel:
location ~ /sub/(\w+)$ {
#channel id is the word after /sub/
# GET /sub/foobar_baz will have the channel id set to 'foobar_baz'
# I hope you know your regular expressions...
nchan_subscriber;
nchan_channel_id $1; #first capture of the location match
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Rodrigo Estrada |