-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot dial webtransport-go server #258
Comments
It will take some until I can look into it. |
This appears to be a regression as dialling the go-webtransport server works as expected with I'm pretty sure there are no port of firewall issues as the only change to make to get it to work is to change the |
Sure, this is correct. Let me explain the change. |
Probably, the problems are caused by these lines:
|
I've made the following changes: diff --git a/transports/http3-quiche/lib/clientsocket.js b/transports/http3-quiche/lib/clientsocket.js
index 5bfa22d..a2c0836 100644
--- a/transports/http3-quiche/lib/clientsocket.js
+++ b/transports/http3-quiche/lib/clientsocket.js
@@ -49,6 +49,7 @@ export class Http3WebTransportClientSocket extends Http3WebTransportSocket {
//
})
this.socketInt.on('message', (msg, rinfo) => {
+ console.info('clientsocket incoming', msg, rinfo)
this.cobj.recvPaket({
msg,
rinfo,
@@ -56,6 +57,16 @@ export class Http3WebTransportClientSocket extends Http3WebTransportSocket {
})
})
this.socketInt.bind(this.localPort)
+
+ const send = this.socketInt.send
+
+ // @ts-expect-error incorrect types
+ this.socketInt.send = (...args) => {
+ console.info('clientsocket outgoing', ...args)
+ // @ts-expect-error incorrect types
+ return send.call(this.socketInt, ...args)
+ }
+
setImmediate(() => this.cobj.onCanWrite())
})
.catch((error) => { If I run the example I get: % DEBUG=websocket*, DEBUG_TRACE=* npm start
> [email protected] start
> node index.js
SERVER start
SERVER ready
CLIENT create session https://127.0.0.1:12345/echo
CLIENT wait for session
clientsocket outgoing <Buffer c3 00 00 00 01 08 fa ab e7 73 c0 3f f0 29 00 00 44 d0 75 9d c7 63 76 4f f6 63 ba e6 04 0c 25 0f 01 68 4a 4a ec fd 5e 7d 04 40 71 15 b5 1e ec 7f 80 91 ... 1200 more bytes> 0 1250 12345 127.0.0.1 [Function: bound packetSendCB]
clientsocket incoming <Buffer ca 00 00 00 01 00 04 cd d1 77 00 00 42 3e 63 17 bc e2 1f 6e f4 8a b6 18 a6 6b f0 c1 82 7f 95 ba 28 09 c9 4b 2b b1 8c bb d9 40 1a a9 37 ec 28 ce 3f 47 ... 1202 more bytes> { address: '127.0.0.1', family: 'IPv4', port: 12345, size: 1252 }
clientsocket outgoing <Buffer ee 00 00 00 01 04 cd d1 77 00 00 40 3d 35 d1 0b 09 cc a8 79 84 b7 6e c9 b0 05 82 7b e6 9f 1e 57 18 9d ad 80 8e 02 9b 6b 1e 80 0b 62 50 87 f4 ab 24 4b ... 114 more bytes> 0 164 12345 127.0.0.1 [Function: bound packetSendCB]
clientsocket incoming <Buffer 47 3d 8f fd 7f 4b 4b b2 5e 45 b2 e8 13 c5 37 8e 05 c1 f1 ef 2e 62 39 78 20 9c be a1 c2 d6 5b> { address: '127.0.0.1', family: 'IPv4', port: 12345, size: 31 }
clientsocket incoming <Buffer 43 5a b8 ba 5d bd 9b 12 e4 b4 c0 0c 12 e2 cd fe e1 a9 f6 35 bf 29 cb 43 37 db ee 8c ad 8a 0d 91 f7 f7 41 17 98 43 30 46 d6 ae 2d 80 cc 06 18 ae 4b ad ... 246 more bytes> { address: '127.0.0.1', family: 'IPv4', port: 12345, size: 296 }
clientsocket outgoing <Buffer 4c cd d1 77 00 7c 69 e6 fe b2 8c 33 04 c9 d4 8d 4e d7 85 d6 f6 41 1a af 46 88 fd> 0 27 12345 127.0.0.1 [Function: bound packetSendCB]
WebTransportError: Opening handshake failed.
at Timeout._onTimeout (file:///Users/alex/Documents/Workspaces/achingbrain/webtransport-go-server/node_modules/@fails-components/webtransport/lib/client.js:91:11)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7) {
[Symbol(Symbol.toStringTag)]: 'WebTransportError'
} |
Ok, that means at least network communication works. |
Another comment, if you want to see what is going on:
and the following lines handle the different stages of connecting. So with printfs you can analyze, where it is stuck. |
I think maybe the bug is that That is, after the first packet is received, the Then after the second packet is received If I remove the negation it seems to work? |
Yes, this can be... But if it is wrong, it must also be changed in other places. |
Ok, then I have to look into it. |
I have to agree, I can't make it work in anything but the most trivial demo app so I think there are certainly some timing bugs in there. For example my ultimate goal here is to integrate |
I am away from my dev machine.
maybe the problem. I believe it must be a true .
|
That seems to make the tests pass with both negations removed. Does this need to be webtransport/transports/http3-quiche/src/http3client.cc Lines 572 to 575 in d5205d8
|
I do wonder if the Edit: I'm not sure this is true now, I can see the visitor being set but |
No I think this is correct, if we assume that checkSession returns a value for rechecking.
That, I agree. We probably need another bool indicating whether a session has been acquired. |
I am starting to work on the problem. |
Here are my attempts. I haven't tested the Go server yet, but I found another issue: The add-on was not loaded quickly enough. |
Ok, the changes discussed seem to work.
So, the fin is not received. I suspect the echo server is the source of the problem, but I will recheck if a fin is sent and/or received. (These echo applications are not trivial; both Firefox and Chrome had bugs that I had to file and patch, but for go I am afraid I have no motivation). |
Also, the real-world application seems to work. merging next... |
And regarding the fin, it does not seem to be reported by the go code. |
Good news on that front - it was user error - the go server needs to explicitly close streams rather than Thanks for fixing this up. |
Ok, that is good.... so no work to do here. |
I'm trying to dial a very simple echo server using webtransport-go but the opening handshake always times out so the session never becomes ready.
I've put a small repro case together here.
Running
npm start
will:webtransport-go
echo server as a separate process@fails-components/webtransport
.npm run browser
starts thewebtransport-go
server but then spits out some JS you can paste into a browser to run the client portion of the test.This works in Chrome but in node it fails with a handshake timeout after a short delay.
The text was updated successfully, but these errors were encountered: