riemann.transport.sse

Exposes subscriptions to the index as server sent event channels

event-to-server-sent-event

Prepare an event for sending out on the wire.

http-query-map

(http-query-map string)

Converts a URL query string into a map.

sse-error-uri

(sse-error-uri ch uri)

Dummy 404 output for invalid URIs

sse-handler

(sse-handler core stats headers)

Queries the index for events and streams them to the client, also initiates a pubsub subscription to the index topic with that query.

sse-out

(sse-out {:keys [out], :as stats} ch pred)

Yield a function that given an incoming event will test for a given predicate and when it matches will format it for sending it over a SSE channel.

sse-server

(sse-server)(sse-server {:keys [host port headers], :or {host "127.0.0.1", port 5558, headers {}}})

Creates a new SSE server for a core.

Options:

  • :host The address to listen on (default 127.0.0.1)
  • :port The port to listen on (default 5558)
  • :headers Additional headers to send with the reply. By default Content-Type is set to text/event-stream and Cache-Control to no-cache. If you do not expose your client web application behind the same host, you will probably need to add an Access-Control-Allow-Origin header here