Skip to content
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

Not receiving heratbeats or messages after connection #149

Open
s888 opened this issue Feb 25, 2014 · 3 comments
Open

Not receiving heratbeats or messages after connection #149

s888 opened this issue Feb 25, 2014 · 3 comments

Comments

@s888
Copy link

s888 commented Feb 25, 2014

After connection is established. Sometimes the websocket class doesn't receive any heartbeats or any response from server.
Not sure if the socket disconnected after connecting but the disconnect event is not triggered on client. The Debug output is:

webSocketLog: connected
WebSocket.asSocketConnected
webSocketLog: request header:
GET /socket.io/1/flashsocket/88775RSOCWQfp31qwgte HTTP/1.1

Upgrade: WebSocket

Connection: Upgrade

Host: xxx

Origin: http://localhost

Cookie:

Sec-WebSocket-Key1: 3_Q4 172582Fcbc4IY2K

Sec-WebSocket-Key2: Y *2M?7 y# 32 496- 1 _ 36

webSocketLog: sent key3: ²?¹N­/M?
WebSocket.asOnSocketData
webSocketLog: response header:
HTTP/1.1 101 WebSocket Protocol Handshake

Upgrade: WebSocket

Connection: Upgrade

Sec-WebSocket-Origin: http://localhost

Sec-WebSocket-Location: xxx

WebSocket.asOnSocketData
webSocketLog: reply digest: ú{"??£y�?ç1N]�%?
WebSocket.asOnSocketData
webSocketLog: received: 1::
webSocketLog: sent: 5:::{xxx}

The message was sent but there wasn't any response or heartbeat after that.

The trace 'WebSocket.asOnSocketData 'is in this function:
private function onSocketData(event:ProgressEvent):void {
trace('WebSocket.asOnSocketData');
var pos:int = buffer.length;

This doesn't happen always though.

Please Help.

@gimite
Copy link
Owner

gimite commented Feb 26, 2014

I'm not exactly sure why, but it seems you are using somewhat old version of the library, because it speaks old WebSocket protocol. It may be fixed by using the latest version of the library. It requires the server to speak RFC version of WebSocket protocol, though.

@s888
Copy link
Author

s888 commented Feb 26, 2014

Thanks for the response.

I built WebSocket.swc from flash-src just 2 - 3 months back.
I am using node.js socket.io on the server. I don't think socket.io supports rfc draft.

Also, there server console has many warnings like 'invalid web socket connection' and
'invalid key'.

I am using this library upon my flex AIR app and for some random clients the Websocket class doesn't establish any connection and it just raises a websocket.close event.

I guess these issues are related.

@reklis
Copy link

reklis commented Feb 26, 2014

Socket io is not standard web sockets. It is more than that. You will need to switch to a different server library or a different client library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants