First message never gets sent
See original GitHub issueFor some reason, whenever a new connection is established, the first message I send always seems to go silently ignored. I switched on logging on the Node side, and this is the output:
engine intercepting request for path "/socket.io/" +14ms
engine handling "GET" http request "/socket.io/?EIO=3&transport=polling&t=1444437518880-2&sid=DMd9QzeN3O9frdIRAAAA" +0ms
engine setting new request for existing client +4ms
engine:polling setting request +0ms
engine:socket writing a noop packet to polling for fast upgrade +89ms
engine:polling writing "�6" +1ms
engine:ws received "5" +41ms
engine:socket got upgrade packet - upgrading +1ms
Sending bullshit-message 1
socket.io-parser encoding packet {"type":2,"data":["bullshit-message","Not seen on client"],"nsp":"/"} +0ms
socket.io-parser encoded {"type":2,"data":["bullshit-message","Not seen on client"],"nsp":"/"} as 2["bullshit-message","Not seen on client"] +1ms
Sending bullshit-message 2
socket.io:client writing packet {"type":2,"data":["bullshit-message","THIS will be seen on client"],"nsp":"/"} +10s
socket.io-parser encoding packet {"type":2,"data":["bullshit-message","THIS will be seen on client"],"nsp":"/"} +10s
socket.io-parser encoded {"type":2,"data":["bullshit-message","THIS will be seen on client"],"nsp":"/"} as 2["bullshit-message","THIS will be seen on client"] +0ms
engine:socket sending packet "message" (2["bullshit-message","THIS will be seen on client"]) +10s
engine:socket flushing buffer to transport +0ms
engine:ws writing "42["bullshit-message","THIS will be seen on client"]" +0ms
Sending Testing 1! to client DMd9QzeN3O9frdIRAAAA
socket.io:client writing packet {"type":2,"data":["message","Testing 1!"],"nsp":"/"} +5ms
socket.io-parser encoding packet {"type":2,"data":["message","Testing 1!"],"nsp":"/"} +4ms
socket.io-parser encoded {"type":2,"data":["message","Testing 1!"],"nsp":"/"} as 2["message","Testing 1!"] +0ms
engine:socket sending packet "message" (2["message","Testing 1!"]) +4ms
Sending Testing 2! to client DMd9QzeN3O9frdIRAAAA
socket.io:client writing packet {"type":2,"data":["message","Testing 2!"],"nsp":"/"} +1ms
socket.io-parser encoding packet {"type":2,"data":["message","Testing 2!"],"nsp":"/"} +1ms
socket.io-parser encoded {"type":2,"data":["message","Testing 2!"],"nsp":"/"} as 2["message","Testing 2!"] +0ms
engine:socket sending packet "message" (2["message","Testing 2!"]) +1ms
engine:socket flushing buffer to transport +2ms
engine:ws writing "42["message","Testing 1!"]" +0ms
engine:ws writing "42["message","Testing 2!"]" +0ms
engine:ws received "2" +15s
engine:socket packet +1ms
engine:socket got ping +0ms
engine:socket sending packet "pong" (undefined) +0ms
engine:socket flushing buffer to transport +0ms
It seems like the first message (the bullshit-message, as I’ve come to call it in testing) is encoded, but never actually sent off to the client. What is going on here?
On client:
engine.io-client:socket changing transport and sending upgrade packet +1ms
socket.io-1.3.7.js:2 engine.io-client:socket setting transport websocket +1ms
socket.io-1.3.7.js:2 engine.io-client:socket clearing existing transport polling +1ms
socket.io-1.3.7.js:2 engine.io-client:polling ignoring poll - transport state "paused" +1ms
socket.io-1.3.7.js:2 engine.io-client:socket socket receive: type "message", data "2["bullshit-message","THIS will be seen on client"]" +10s
socket.io-1.3.7.js:1 socket.io-parser decoded 2["bullshit-message","THIS will be seen on client"] as %j +9s Object {type: 2, nsp: "/", data: Array[2]}
socket.io-1.3.7.js:1 socket.io-client:socket emitting event %j +9s ["bullshit-message", "THIS will be seen on client"]
Bullshit data received THIS will be seen on client
socket.io-1.3.7.js:2 engine.io-client:socket socket receive: type "message", data "2["message","Testing 1!"]" +5ms
socket.io-1.3.7.js:1 socket.io-parser decoded 2["message","Testing 1!"] as %j +5ms Object {type: 2, nsp: "/", data: Array[2]}
socket.io-1.3.7.js:1 socket.io-client:socket emitting event %j +5ms ["message", "Testing 1!"]
Data received Testing 1!
socket.io-1.3.7.js:2 engine.io-client:socket socket receive: type "message", data "2["message","Testing 2!"]" +8ms
socket.io-1.3.7.js:1 socket.io-parser decoded 2["message","Testing 2!"] as %j +8ms Object {type: 2, nsp: "/", data: Array[2]}
socket.io-1.3.7.js:1 socket.io-client:socket emitting event %j +8ms ["message", "Testing 2!"]
Data received Testing 2!
Issue Analytics
- State:
- Created 8 years ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
11 Reasons Why Your Text Message Didn't Get Delivered
1. Your message was flagged as Spam by the recipient's carrier · 2. You need a different type of phone number · 3....
Read more >"She Never Texted Me First... Until I Sent THIS" - TextGod.com
What to do when a girl never texts you first. There are different reasons and mistakes when it comes to her not texting...
Read more >10 Reasons Why Some Messages Don't Get Delivered
10 Reasons Why Some Messages Don't Get Delivered · 1) The recipient's phone is switched off · 2) False negative · 3) The...
Read more >“My Boyfriend Never Texts Me First” — Here's What That Means
It can be discouraging when your boyfriend or girlfriend never texts first, but it doesn't necessarily mean there's anything wrong.
Read more >She never texts first, but when I text her she enthusiastically ...
Yes, you should. If the person really cares about you and misses you, will text you once they see you didn't send any...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Digging into this a bit more, I believe something strange is going on with the
onopen
event. Here is the order of events I’m seeing in the browser:onopen
eventlogin
)onopen
eventWhy is
socket.client-io
firing theonopen
event before theengine.io
has emitted it?UPDATE: I was able to solve my problem by changing:
By default
transports
seems to be set to['polling', 'websocket']
. I have no idea whatpolling
is or what thetransports
option does (documentation for this is very hard to find). But it seems to solve my problem. I now consistently see my requests sent and received.Any ideas? Same issue
what i’ve pointed out is that at emmititing ‘immediate’ event the socket.client.Client.conn.socket.upgraded is false, but after 1.5s that is true, and all works just fine