Cannot call method 'packet' of null #337

Closed
kitek opened this Issue Nov 10, 2011 · 5 comments

Comments

Projects
None yet
5 participants
@kitek

kitek commented Nov 10, 2011

Hi, when socket.io-client call event connect_failed I got error:

TypeError: Cannot call method 'packet' of null
at Socket.packet (/opt/node-0.4.12/lib/node/socket.io-client/lib/socket.js:272:22)
at SocketNamespace.packet (/opt/node-0.4.12/lib/node/socket.io-client/lib/namespace.js:64:17)
at SocketNamespace.emit (/opt/node-0.4.12/lib/node/socket.io-client/lib/namespace.js:113:17)
at SocketNamespace.<anonymous> (/home/node/test.js:104:10)
at SocketNamespace.$emit (/opt/node-0.4.12/lib/node/socket.io-client/lib/events.js:167:15)
at SocketNamespace.onPacket (/opt/node-0.4.12/lib/node/socket.io-client/lib/namespace.js:152:14)
at Socket.onPacket (/opt/node-0.4.12/lib/node/socket.io-client/lib/socket.js:397:30)
at Transport.onPacket (/opt/node-0.4.12/lib/node/socket.io-client/lib/transport.js:81:17)
at Transport.onData (/opt/node-0.4.12/lib/node/socket.io-client/lib/transport.js:58:16)
at [object Object].stateChange (/opt/node-0.4.12/lib/node/socket.io-client/lib/transports/xhr-polling.js:81:16)
@mindon

This comment has been minimized.

Show comment
Hide comment
@mindon

mindon May 14, 2012

it seems the issue comes in benchmark.
when the websocket response slow & the connectTimeoutTimer triggered,
the transport method is switched from websocket to xhr-polling
--- the socket status is: .connected === true, .transport === null

then if .packet method (socket.js line 293) or .onClose method (socket.js line 279) is called, the error will be thrown.

another 2 calls may throw error for the same issue:
.transport.payload around line 311
.transport.close around line 455

mindon commented May 14, 2012

it seems the issue comes in benchmark.
when the websocket response slow & the connectTimeoutTimer triggered,
the transport method is switched from websocket to xhr-polling
--- the socket status is: .connected === true, .transport === null

then if .packet method (socket.js line 293) or .onClose method (socket.js line 279) is called, the error will be thrown.

another 2 calls may throw error for the same issue:
.transport.payload around line 311
.transport.close around line 455

@mdahiemstra

This comment has been minimized.

Show comment
Hide comment
@mdahiemstra

mdahiemstra Oct 12, 2012

Any new thoughts on a fix? Got the same issue. But not really predictable when. Usually around 10k concurrent users but sometimes at 20+k. Has this got to do something with the client server on which running the benchmark? That it can't keep up. If I change the transport to websockets only it seems to happen less. But then i'm getting warn - client not handshaken client should reconnect messages around 17k conc. users

Any new thoughts on a fix? Got the same issue. But not really predictable when. Usually around 10k concurrent users but sometimes at 20+k. Has this got to do something with the client server on which running the benchmark? That it can't keep up. If I change the transport to websockets only it seems to happen less. But then i'm getting warn - client not handshaken client should reconnect messages around 17k conc. users

@xsellier

This comment has been minimized.

Show comment
Hide comment
@xsellier

xsellier Jul 3, 2014

Still happening

xsellier commented Jul 3, 2014

Still happening

@rauchg

This comment has been minimized.

Show comment
Hide comment
@rauchg

rauchg Jul 4, 2014

Contributor

Does this happen in 1.0 ?

Contributor

rauchg commented Jul 4, 2014

Does this happen in 1.0 ?

@xsellier

This comment has been minimized.

Show comment
Hide comment
@xsellier

xsellier Jul 4, 2014

I don't know, I have to use the version 0.9.6 due to dependencies.

xsellier commented Jul 4, 2014

I don't know, I have to use the version 0.9.6 due to dependencies.

@rauchg rauchg closed this Nov 25, 2014

lattmann pushed a commit to lattmann/socket.io-client that referenced this issue Jul 23, 2015

Merge pull request #337 from 3rd-Eden/handshakeData
Expose path and querystring in handshakeData
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment