WebSocket Support

This page is a quick reference to supplement the full RelayMiner config reference and the full Supplier config to add WebSocket support to your RelayMiner and Supplier.

See the Supplier & RelayMiner cheatsheet for more details on running a Supplier & RelayMiner.

1

Base — Onchain Supplier configuration

Update your supplier_config.yaml to add WebSocket support:

owner_address: <OWNER_ADDRESS>
operator_address: <OPERATOR_ADDRESS>
stake_amount: <STAKE_AMOUNT>upokt
default_rev_share_percent:
  <REWARD_ADDRESS>: 100
services:
  - service_id: "base"
    endpoints:
      - publicly_exposed_url: http://<YOUR_PUBLIC_RELAY_MINER_IP>:8545
        rpc_type: JSON_RPC
      - publicly_exposed_url: ws://<YOUR_PUBLIC_RELAY_MINER_IP>:8546
        rpc_type: WEBSOCKET

Then run:

pocketd tx supplier stake-supplier ...

to update your Supplier record onchain.

2

Base — Offchain RelayMiner configuration

Update your relayminer_config.yaml to add WebSocket support:

default_signing_key_names:
  - supplier
smt_store_path: /path/to/.pocket/smt
pocket_node:
  query_node_rpc_url: https://<RPC_NODE>
  query_node_grpc_url: https://<GRPC_NODE>:443
  tx_node_rpc_url: https://<TX_NODE>
suppliers:
  - service_id: "base"
    # Default (JSON-RPC)
    service_config:
      backend_url: "http://<YOUR_BASE_SERVICE_BACKEND_IP>:8545"
    rpc_type_service_configs:
      # JSON-RPC WebSocket
      websocket:
        backend_url: "ws://<YOUR_BASE_SERVICE_BACKEND_IP>:8546"
    listen_url: http://0.0.0.0:8545
  metrics:
    enabled: false
    addr: :9090
  pprof:
    enabled: false

Then restart your RelayMiner to apply the changes:

pocketd relayminer start ...

Key configuration notes:

  • The publicly_exposed_url for endpoints with rpc_type: WEBSOCKET should be the same as the JSON_RPC endpoint except using ws:// or wss:// instead of http:// or https://.

  • In relayminer_config.yaml, suppliers[].rpc_type_service_configs must explicitly include websocket.backend_url.

  • The common default EVM WebSocket port is 8546, but it may vary based on your setup.

Related references:

  • Full RelayMiner config reference: https://dev.poktroll.com/operate/configs/relayminer_config

  • Full Supplier config: https://dev.poktroll.com/operate/configs/supplier_staking_config

  • Supplier & RelayMiner cheatsheet: https://dev.poktroll.com/operate/cheat_sheets/supplier_cheatsheet

Was this helpful?