Websocket serve bound to port 80 #5807
Replies: 1 comment
-
Posted at 2016-11-08 by Ollie Actually, it seems the board just needed resetting. Maybe already bound to another port - I don't know. Anyway it works. @gfwilliams please delete if deem appropriate. Posted at 2016-11-09 by @gfwilliams No problem. Probably worth leaving up in case anyone has similar problems. Which board were you using, and was the Web IDE set up to send Stuff like Espruino WiFi and the Pico+WiFi should automatically reset the WiFi module each time code is uploaded. The ESP8266 itself wouldn't do that, although the socket server should automatically shut connections down on a software Posted at 2016-11-09 by Ollie It's a NodeMCU. I think it may have been that I had a persistent wifi connection with I worked it into my code last night and found it would not work in Chrome. In Firefox, the server can send, but the client cannot send back - or at least the message is never received. I've stripped my code back to basically just run the server example on the websockets page and still no joy. In chrome, nothing from the server and I get this in console.
And an attempt to send with
In Firefox I get the server sent message The connection appears to get upgraded based on my logging, but the This is the code, almost identical to the example
Could there be a problem with the module? I'm struggling to see how I could be going wrong? Posted at 2016-11-09 by @gfwilliams Try now... It looks like it was an issue with the module. As far as I can tell, the browsers keep tweaking their implementations, and things that used to work don't. I'm pretty sure the server was tested at some point quite recently. Posted at 2016-11-09 by Ollie That's fixed it! Have messaging both ways in Chrome. Excellent thank you @gfwilliams! Posted at 2016-11-09 by Ollie One further issue, maybe a showstopper. I'm now testing on mobile Safari and Google Chrome - both based on Webkit - and I get this in Mobile Safari (I'm not able to debug in Chrome but infer same)
Looking into this, I'm not sure that HTTP/1.0 websockets are supported any longer. I seem to recall reading that Espruino HTTP/Websockets is still on the 1.0 standard. Is this correct? I am guessing I'd fare better in Android :/ Posted at 2016-11-09 by @gfwilliams Yeah, that's built into Espruino. As a hack you could get a hex editor, search the binary file for Posted at 2016-11-09 by Ollie Well that's worth a shot. Thanks again. Posted at 2016-11-09 by Ollie If I may, Gordon you're a genius. That was enough to bamboozle Safari! I've got data and the connection seems just as stable as desktop. Posted at 2016-11-09 by @gfwilliams \o/ what did you change it to? It's possible that 1.1 might not cause too many problems for other things... Or we could make it configurable. Posted at 2016-11-09 by Ollie Just 1.1. And it has been fine. We brought the whole rc car project together tonight (thankfully) and have been driving it from iPhone - needs a couple of tweeks - but nothing major. Thanks for your help on the websockets piece today. Posted at 2017-08-05 by seanclark Hi, I'm getting the same problem in that Safari doesn't like the HTTP/1.0 header form the Espruino.
Can you explain a little more about how to fix it? Sean Posted at 2017-08-07 by @gfwilliams @ollie did you ever notice any problems using 1.1 as the version string - eg when trying to serve up normal webpages? @seanclark this actually required changing the binary manually - so it's not an easy option. YOu basically download the build, open it with a hex editor then search for Posted at 2017-08-16 by Ollie @gfwilliams No, I've had no issues, but admittedly this binary only serves a RC car controller webpage and the websocket connection. I'm not using it anywhere else, but it works like a charm for that. Maybe not enough evidence to change it :) Posted at 2017-08-16 by @gfwilliams Just changed it in GitHub so the latest builds will have the change - I'll see what happens when it gets some use. I can't imagine hitting many problems. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2016-11-08 by Ollie
I can't get this to work. Other ports work fine, but if I try bind the server to port 80, I get:-
All the examples seem to use ports other than 80, so I wonder if I'm missing something?
Beta Was this translation helpful? Give feedback.
All reactions