-
-
Notifications
You must be signed in to change notification settings - Fork 893
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
arduino / esp8266 based client cannot connect to flask-socketio server #238
Comments
Can you run the server with logging enabled? Add |
for you, anything. do you want me to hook into some error events like this example: @socketio.on_error_default or is it going to start printing statements out? or am i going to need to hunt down the log file and tail around in it? |
No, this is simpler. On the server code, you just need to add |
The logging has move forward past a couple of errors, but I could use a little direction with these log statements: d6679dda774d41cabaf11837cc2821cb: Received request to upgrade to websocket Is this saying a message of some kind should be send with the ping or that there was no ping sent? could you give me a bit more information about your implementation of upgrading to websocket? The initial problem was the the SID was 32 char long from flask-socketio, but the length is 20 from a node/javascript server, so I'm thinking , maybe there are some spec or implementation details that are different each step of the way. For example, I am sending a ping up to multiple times, but maybe a message length, or timing issue, or message format issue like binary, versus unicode, is the hang up. |
Also, one of the errors printed via the server says code 400, message Bad HTTP/0.9 request type ('\x81\x814527\x06\x81\xa64655\x00\x04n\x17UB\XQ\x14\x19N\x16[PFGWRP\x16') all of the microcontroller client calls are http/1.1 is there some difference that would cause a problem? |
So the microcontroller client is attempting to upgrade via long polling but it isnt sending a jsonp request with ping:probe in it. I found this lead looking at previous issues and got this one : miguelgrinberg/python-socketio#3 I assume you are still strict about this. What i'm wondering is have your thoughts changed about the implementation? the node server currently allows the microcontroller to upgrade to websockets with a sid and no ping. What are the pros and cons of skipping it? for a microcontroller, this would save some effort, processing, bandwidth, etc, and seems to be in the spirit (thought not the spec) of the official socketio server implementation. |
I follow the socket.io and engine.io specifications, not a particular implementation. The PING/PONG probe handshake is part of the upgrade process, I don't see how that could be removed. But if you want to connect directly via websocket, that is working. That issue you referenced above has been resolved, you can connect directly via websocket if that works for you. A direct websocket connection does not require any handshake. |
Thanks, thats helpful. I didn;t find the spec where a direct websocket connection would pass back a sid, and the access-key information. I'll dig around in your lirbary for how that's handled, but do you have reference to that in the socketio spec? |
@itsjesseyo to my knowledge using a direct websocket connection is an undocumented aspect of the protocol. I reverse-engineered it from looking at the trafic between the JS client and the node server. |
lol. isn't that coding to the implementation not the spec? i'll have a look at the code and wireshark s needed. thanks. |
@itsjesseyo wireshark should do it, but the network tab in your browser's debugger is much easier and will give you the same information. I looked at the exchanges in Chrome's debugger to learn about this. And yes, the part about a direct websocket connection was done via reverse-engineering. I did not have it in my first implementation, but it was requested because there are some clients out there that can only work with WebSocket. |
Please reopen when you can provide the requested information. |
I'm trying to get a microcontroller with wifi built in to connect to the server and the server throws some errors and will not let the microcontroller upgrade to websockets.
I've tried various config parameters, here's my latest:
socketio = SocketIO(app, allow_upgrades=True, cookie=None, http_compression=False)
you can reference the errors in more depth here:
washo4evr/Socket.io-v1.x-Library#5
the server says something like:
[07/Mar/2016 22:24:32] code 400, message Bad request version ('\x07\x00\x00\x00\x06\x01\x00')
and the client says:
Exception (0):
epc1=0x40207f40 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x000000
The dev on the client says he's not getting the HTTP/1.1 101 Switching Protocols so the client connection never gets upgraded to websocket.
i've confirmed the client connects to the server just fine before the attempt to websocketify.
I've confirmed via a webpage that the socket server is working fine in expected use. I'm looking for some help on which side to explore for a solution.
The text was updated successfully, but these errors were encountered: