@endel we would really value your opinion on the new extension seeing as you rely on defold-websocket for Colyseus. The new extension will give a performance boost and also reduce the number of dependencies required.
And @BunBunBun we’d appreciate your feedback as well since you use WebSockets in Raft Wars right?
No no, the extension is completely self-contained. It uses the socket code from the engine, exposed as dmSocket and dmSSLSocket to extensions through the Defold SDK. The actual WebSocket layer with handshake code etc is based on wslay.
Thanks!
Currently it’s using TCP_NODELAY, but I’m also in the process of adding a similar function for TCP_QUICKACK, it should be available in the defold beta later today. However, I’m not familiar with the quick ack functionality, so I’m not sure if one needs to set it once, or several times. I hope someone will help with this info
Also, TCP_QUICKACK isn’t supported on iOS/macOS and Windows.
Ah, I should have been more clear. You need the 1.2.173 beta of Defold too to use it, since we’ve added a lot more functionality to the dmSDK (e.g. socket.h)
I’m also not sure of the implications of quick ACK. is it always beneficial to have it enabled regardless of how the socket is used (I’m thinking HTTP connection vs socket used in a game)? I also saw in a SO post that the quick ACK socket option can be changed by the system and that we might have to set it after every send.
Thanks for the clarification, it works using the beta.
So far the Desktop build is working just fine with Colyseus, but the HTML5 build is not connecting to the right endpoint (notice the URL segments and query string in the console log)
@endel I’ve uploaded a new version with a separate code path for the html5 code. I did make a quick stab in the dark by adding the path to the url when getting the address (trying to compare the functionality with the old extension), but I currently have no way of knowing if that works. You don’t happen to have an example echo test server on such an endpoint I could test with?
EDIT: To use this, update the beta editor (or bob.jar) and refetch the extension.
Tried this in my colyseus project (using @endel’s new websocket-extension branch). It seems to work without problems in the html5 build. But for some reason, I am getting an error when running from the editor (Project/Build). I am using Windows 10, Defold 1.2.173 beta and latest websocket extension.
ERROR:WEBSOCKET: Failed to find the Upgrade keyword in the response headers
ERROR:WEBSOCKET: Response:
"HTTP/1.1 101 Switching Protocols
Server"
DEBUG:SCRIPT: websocket error: Failed verifying handshake headers:
Failed verifying handshake headers:
rver
Thoughts on what could be the issue? I am connecting via wss, nginx has been configured for http upgrade. It works fine with my html5 build, but not when running from the editor. I don’t have this issue with the old defold-websocket setup.
The Html5/Emscripten sockets are actually already websockets, so they don’t have to do the handshake.
For the other platforms, the extension expected the websocket handshake return headers as specified here: https://tools.ietf.org/html/rfc6455 (see page 7)
I’ve already seen one discrepancy from that standard, and looking at your printout of the headers, you server doesn’t really conform 100% either:
"HTTP/1.1 101 Switching Protocols
Server"
Did the old extension (defold-websocket) work for you?
Our goal is to make them as close as possible in supporting the servers they already work with.