Crates.io | megaphone-broker |
lib.rs | megaphone-broker |
version | 0.10.5 |
source | src |
created_at | 2024-02-25 17:13:19.144288 |
updated_at | 2024-04-28 09:13:02.601357 |
description | Reverse proxy for long running requests and server streaming |
homepage | |
repository | https://github.com/dghilardi/megaphone |
max_upload_size | |
id | 1152632 |
size | 223,774 |
Megaphone is a reverse proxy that allows clients to connect to a server using long running requests and server streaming. It is useful because it abstracts the complexity of handling long running requests and server streaming from the server, allowing it to focus on the business logic. It also gives the client a single endpoint to connect to, making it easier to manage the connection and reducing the opened connections and the overall traffic overhead.
To create a channel, the [POST] /create
endpoint must be called.
Each channel:
503 Service Unavailable
status code.producerAddress
and consumerAddress
, the first one can be used to write into the channel, the second one to read from it.To write into a channel, the client must call the [POST] /write/{producer-address}/{stream-id}
endpoint.
The server will respond with a 201 Created
status code if the message was successfully written into the channel.
The only information needed to read from a channel is the consumerAddress
returned when the channel was created.
At the moment the only supported protocol is http streaming, so to read from a channel the client must call the [GET] /read/{consumer-address}
endpoint.
To access a channel using http streaming, the client must call the [GET] /read/{consumer-address}
endpoint.
The server will keep the connection open for 20 seconds and send messages as they arrive.