node: show websocket url in logs#22307
Conversation
renaynay
left a comment
There was a problem hiding this comment.
Tested it out and it LGTM, thanks for the fix!
renaynay
left a comment
There was a problem hiding this comment.
TestNodeRPCPrefix looks broken, will take a look
|
This diff will fix the failing test, ws endpoint was taking the endpoint of the http server instead of ws --- a/node/node_test.go
+++ b/node/node_test.go
@@ -558,7 +558,7 @@ func TestNodeRPCPrefix(t *testing.T) {
func (test rpcPrefixTest) check(t *testing.T, node *Node) {
t.Helper()
httpBase := "http://" + node.http.listenAddr()
- wsBase := "ws://" + node.http.listenAddr()
+ wsBase := "ws://" + node.ws.listenAddr()
if node.WSEndpoint() != wsBase+test.wsPrefix {
t.Errorf("Error: node has wrong WSEndpoint %q", node.WSEndpoint()) |
|
I think we put them on the same port on purpose when the port is zero. Is it a problem to have them on the same port in this case? |
No, I thought it was more UX-friendly this way, but it's really just a "pick either option" kind of thing. Should I revert that? |
|
I would prefer to keep them on the same port in this case. |
|
Fixed |
There was a problem hiding this comment.
Hm. Is there ever a case where neither ws nor rpc is allowed, but we still want to not exit here? I think the answer is no, but .... graphql..? cc @renaynay
There was a problem hiding this comment.
Graphql cannot be allowed if rpc is disabled
This PR does two things:
Ifgeth --dev --ws --ws.port 0 --http --http.port 0is used, then ws and http are both randomized, to different ports.geth --dev --ws --ws.port 9999 --http --http.port 9999, then it shows in the logs that, yes, websocket is up, even if it's on the same port.