An open API service indexing awesome lists of open source software.

https://github.com/ndrean/sse

Produce ServerSentEvents in Elixir
https://github.com/ndrean/sse

elixir https sse

Last synced: 10 months ago
JSON representation

Produce ServerSentEvents in Elixir

Awesome Lists containing this project

README

          

# Sse

The Elixir code tests works only in HTTP mode, but `curl` works for both.
To change mode, select in "Application" between the two setups:

```elixir
#Application
{Plug.Cowboy, scheme: :https, plug: SSE.Router, options: plug_options},
{Plug.Cowboy, scheme: :http,...}
```

In `Router`, you have to declare the client endpoints for CORS.
Client side, you have to select also the endpoint whether HTTP or HTTPS (in .ENV)

The Docker image works locally on HTTPS. It needs some modifications to be able to deploy.

For HTTP/1.1 between and , run:

```bash
PORT 4000 mix run --no-halt
```

For TLS HTTP/2, between self-signed and , run:

```bash
PORT=4000 mix run --no-halt
```

Used `mkcert` for self-signed certificats

```bash
# run this one
curl -v https://localhost:4043/sse

# then run this one
curl -X POST -H "content-type: application/json" -d '{"test": "hello Amy"}' https://localhost:4043/post
```

Caddy is ready.