/epher

Event Pusher

Primary LanguageGoMIT LicenseMIT

Event Pusher Go Coverage Status

This stuff allows users to subscribe to a given channel and let the services to send notifications to those channels with an HTTP request. All the messages sent to the websocket endpoint will be dropped.

Usage

  -listen string
    	HTTP and WS server listen address (default ":9090")
  -redisAddr string
    	Redis server address (optional)
  -redisPass string
    	Redis server password (optional)

Example

Start the server:

$ go run main.go

It'll start on port 9090 by default.

Connect with websocket to the subscribe endpoint (for example using websocat):

$ websocat ws://127.0.0.1:9090/subscribe/test1

Send HTTP post requests to the publish endpoint:

$ curl 127.0.0.1:9090/publish/test1 -d 'test message'

You should see your message in the websocket client.