Running multiple applications that have websocket connections established from same IP address to public Hermes endpoint might get that IP address rate limited, therefore connections will be closed.
This can happen if amount of bytes received exceeds the limit per IP address.
Hermes websocket gateway establishes only one websocket connection to public Hermes endpoint, aggregates feed ids and streams corresponding Pyth price updates to subscribers. Applications can use gateway's endpoint instead.
Compile using this command:
cargo build --release
Move compiled file or cd
into target/release
./hermes-gateway
Usage: hermes-gateway <COMMAND>
Commands:
ws Run on websocket
ipc Run on Unix socket
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
Run with custom address or path (Default: 127.0.0.1:7071
for ws
and /tmp/hermes_gateway.ipc
for ipc
):
./hermes-gateway ws 127.0.0.1:7081
./hermes-gateway ipc /path/to/socket
Reading from Unix socket connection:
-
Read u16, this value represents price update size
-
Create buffer with this size
vec![0; len]
-
Read exact size to this buffer
-
Parse buffer into a struct using serde_json