Information extracted from the Geth documentation page regarding command-line options:
--ws (default: false) ($GETH_WS)
Activation of the WS-RPC server
--ws.addr value (default: "localhost") ($GETH_WS_ADDR)
Interface on which the WS-RPC server listens
--ws.api value ($GETH_WS_API)
APIs offered through the WS-RPC interface
--ws.origins value ($GETH_WS_ORIGINS)
Specific origins allowed for websocket requests
--ws.port value (default: 8546) ($GETH_WS_PORT)
Port on which the WS-RPC server listens
--ws.rpcprefix value ($GETH_WS_RPCPREFIX)
Prefix path for serving JSON-RPC over HTTP. Use '/' to serve on all paths.
If only using the --ws
option, the default value of --ws.addr
is applied and the node will only accept requests from the local machine.
You can specify the network interface that the node should listen on by providing its IP address or hostname. For example, if your server's IP is 123.123.123.123
, you can use the following IP. This setup allows the node to receive WS connections specifically to this IP.
geth --ws --ws.addr "123.123.123.123"
If you wish to listen for incoming requests from all network interfaces of the server (e.g., localhost, LAN cables, VPN tunnel, wifi, etc.), you can set the value of --ws.addr
to 0.0.0.0
. This configuration enables the node to accept all inbound WS connections.
geth --ws --ws.addr "0.0.0.0"