I have created a chain node on aws ec2 instance using geth.
Do I need to enable something or what ip should I use to connect to it?
I am using web3.js using new Web3.providers.WebsocketProvider(‘wss_address’, abiOptions)
I enabled ws for it using –ws. Where I got "WebSocket enabled url=ws://127.0.0.0.1:8546".
2
Answers
With this command:
And this line to connect:
All working, thanks for support)))
P.S. In my case, it was the connection with PORT specification that worked. And only through ws, not wss. And I didn't notice any difference when connecting via IP with or without DNS
From the Geth docs page on command-line options:
If you only specify the
--ws
option, the default value of--ws.addr
is used and the node listens for incoming requests only from the local machine.You can specify the network interface, which the node listens on, by its IP address or hostname. For example if your server’s IP is
123.123.123.123
, you can specify the following IP. This enables the node to accept WS connections to this IP.Or you want to listen to incoming requests from all network interfaces of the server (e.g. localhost, all LAN cables, VPN tunnel, wifi, …), you can specify the value of
--ws.addr
as0.0.0.0
. This enables the node to accept all incoming WS connections.