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
Websockets now broken. #1405
Comments
@gfwilliams I am really sorry to have caused a bad release. I hope that the benefits outweigh the trouble caused. Thank you for the detailed repro instructions. A fix is ready in #1408. |
No problem - I should have had tests that covered it better, so thanks for tweaking the existing And yes, the benefits of your commits absolutely outweigh this one very small issue :) |
this is still an issue in the latest release. i cannot fully test, as i cannot complete my onInit() code. in wifi 1v97.62, i cannot complete a connection with espruino as the ws server and a webpage as the ws client. this does work in 1v96. |
Are you able to provide a simple test case with source files (use gist?) so that the issue can be produced easily to aid debugging? |
sure. when using the server url in a browser, the client never connects via websocket. `var WebSocket = require("ws"); var WIFI_NAME = ""; var wifi; function onInit() { var page = '<script>var ws;setTimeout(function(){'; function onPageRequest(req, res) { function startServer() { |
I can confirm that the code fails on the unix build:
|
The code above works on: git checkout RELEASE_1V96 in the console in chrome: MSG:Hello from Espruino! |
Added a test which sends HTTP headers which take more than MSS bytes (536) and therefore the httpParseHeaders() needs to be called later again after the next packet arrives. Fixes espruino#1405
Added a test which sends HTTP headers which take more than MSS bytes (536) and therefore the httpParseHeaders() needs to be called later again after the next packet arrives. Fixes espruino#1405
@wilberforce Thanks for isolating it. Fix is in #1415. |
Hi @opichals,
It looks like the recent HTTP chunked PR has broken websocket support. There's a post on it here: http://forum.espruino.com/conversations/320553/
Basically run this on node.js:
and this on Espruino (you can do it on the Linux build if you copy ws.js/ws.min.js to a directory called node_modules):
Then you get
RangeError: Invalid WebSocket frame: RSV1 must be clear
from node.jsws.js
doesn't actually get around to sending anything, and it looks likerequire("net").connect
calls back twice now, which causesonConnect
/handshake
inws.js
to be called twice, which breaks everything.Could it be that it's now trying to parse headers even on connections that aren't HTTP?
It'd be good to get a fix out for this soon as it looks like it's broken in the 1v97 release :(
The text was updated successfully, but these errors were encountered: