FlashSocket.IO
FlashSocket.IO copied to clipboard
Socket messages appear to be one behind
I'm connecting to a socket.io server (netty) using this FlashSocket.IO library
Everything (connection, handshake, protocol upgrade) seems to work correctly, but when it comes time to start sending/receiving messages via the actual socket, I'm noticing an odd trend: all of the responses to my messages are behind by 1.
The most basic example I can give is that I have to send two PINGs before I receive a single PONG, and the PONG that I do receive is actually a response to the first PING.
A more detailed example: I send a message with a room ID. This message is supposed to receive a response in the form of "room-ID activated." I will not receive that response until after another message is sent from the server.
I can force the server to send another message by following the room ID message with a PING. This triggers a PONG sent from the server, but the only message I receive on the client side is the "room-ID activated" message.
I have a feeling the problem lies somewhere within this FlashSocket.IO library, but I'm not sure exactly where to look. I know for a fact that the server is sending all the messages it's supposed to send because I have a test app written in JavaScript using socket.io's client and it works as expected.
Hi Marcela, do you have a reproducible, isolated test case? Something I can get up and running to appreciate the problem?
I've created this example: https://github.com/mm-marcela/FlashSocket.IO-Tester
I believe this is what we are using for the server: https://github.com/mrniko/netty-socketio/releases/tag/netty-socketio-1.7.4
I noticed that I was getting a 40 (CONNECT) after sending 5 (UPGRADE). On a whim, I decided to send a second UPGRADE after receiving the CONNECT. This triggered a 6 (ACK) response from the server. At this point, everything appears to work as expected: If I send the room ID after the 6, I immediately receive the "room-ID activated" message, and everything works fine.
I'm hesitant to close the issue because I don't understand why I would have to send a second UPGRADE once I've connected in order to get it to work.
From what I remember that should all be taken care of internally. I don't understand why you're seeing this but I haven't noticed any problem before (still not had a chance to take a proper look, sorry!)