https://github.com/nitro/go-hermes-prototype
WebSocket asynchronous pub-sub messaging system
https://github.com/nitro/go-hermes-prototype
Last synced: about 1 year ago
JSON representation
WebSocket asynchronous pub-sub messaging system
- Host: GitHub
- URL: https://github.com/nitro/go-hermes-prototype
- Owner: Nitro
- License: mit
- Created: 2017-10-05T13:11:13.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-03T20:23:18.000Z (about 8 years ago)
- Last Synced: 2024-06-20T19:20:32.341Z (almost 2 years ago)
- Language: Go
- Homepage:
- Size: 27.3 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hermes

## Purpose
Hermes is an asynchronous pub-sub messaging system that uses the Websocket protocol to talk to its HTTP clients. It's meant to be used as a lightweight self-hosted replacement for Pusher.
## Configuration
The following environment variables are recognised by the Go application:
Variable | Mandatory | Default
-------------------------| --------- | -------------------
HERMES_HTTP_PORT | no | 8000
HERMES_NATS_URL | no | nats://localhost:4222
HERMES_WEBSOCKET_TIMEOUT | no | 15m
HERMES_LOGGING_LEVEL | no | info
## Dependencies
- Websockets: https://github.com/gobwas/ws
- NATS client: https://github.com/nats-io/go-nats
## Design
A NATS server has to run first for Hermes to work. Hermes uses NATS to handle the pub-sub functionality.
Hermes exposes an HTTP server that serves two routes:
- `/subscribe` - clients can use it to initiate a websocket connection via HTTP GET and request subscription to mesages with a given "subject"
- `/publish` - backend services can send messages to it via HTTP POST requests, which contain a query parameter `subj` that specifies the NATS "subject". Subsequently, Hermes will broadcast the received message to the clients that are subscribed to this "subject"
