Websockets are disabled by default.
See RSKj configuration reference
To enable websockets on RSKj:
(1)
Add -Drpc.providers.web.ws.enabled=true
to your java
command when starting RSKj.
(2)
Update the configuration file.
The file is named mainnet.conf
for RSK Mainnet.
Your config file should look like this:
rpc {
providers : {
web: {
cors: "*",
http: {
enabled: true,
bind_address = "0.0.0.0",
hosts = ["localhost", "127.0.0.1"],
port: 4444,
}
ws: {
enabled: true,
bind_address: "127.0.0.1",
hosts = ["localhost", "127.0.0.1"],
port: 4445,
}
}
}
...
}
After this, restart your RSKj for the config to take effect.
Now if you repeat the same command from your question:
wscat -c ws://localhost:4445/websocket
You should be able to establish a connection.