Skip to content

Commit

Permalink
Add Websocket support guide
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Jun 17, 2023
1 parent 24b5eca commit f5f1495
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MIGRATIONS/v0.0.9.md → MIGRATIONS/v0.0.8-0.0.10.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# v0.0.8 -> v0.0.9
# v0.0.8 -> v0.0.10

This upgrade brings a new .env file & removes the redis dependency. Please modify your .env file to take effect.

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ python3 rpc.py
## Running in Production

- [Systemd Files](./docs/SYSTEMD_FILES.md)
- [Tendermint Websocket Support](./docs/WEBSOCKET.md)
- [Akash](./docs/AKASH.md)

## Documentation
Expand Down
63 changes: 63 additions & 0 deletions docs/WEBSOCKET.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Tendermint WebSocket

In Cosmos, some application use Tendermint's websocket to subscribe to events (Specifically keplr to check for when a Tx has completed in their UI). The following is an example for how to add WebSocket support to your cached RPC via NGINX.

## NGINX Config

```conf
http {
upstream juno_rpc_cache {
server 11.123.123.123:5001;
}
upstream juno-ws-backend {
ip_hash;
# Juno direct RPC address
server 11.123.123.123:26657;
}
# ...
server {
listen 80;
server_name juno-rpc.reece.sh;
# websocket connections only
# (We convert wss to ws so we do not have to deal with certificates)
location /websocket {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://juno-ws-backend/websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# every other requests through juno-rpc.reece.sh goes here to the standard RPC
location / {
add_header Access-Control-Max-Age 3600;
add_header Access-Control-Expose-Headers Content-Length;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
add_header Referrer-Policy 'origin';
proxy_pass http://juno_rpc_cache;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
}
```

## Caddy Config

- TODO

0 comments on commit f5f1495

Please sign in to comment.