Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SocketIO Chrome Inspector Frames

I was playing around with Socket.IO and ran into some questions when viewing the frames in the chrome inspector.

enter image description here

What do the numbers beside each frame's content mean?

like image 804
Aldee Avatar asked Dec 19 '22 18:12

Aldee


1 Answers

That's the Engine.io protocol where the number you see is the packet encoding:

<packet type id>[<data>]

example:

2probe

And these are the different packet types:

0 open

Sent from the server when a new transport is opened (recheck)

1 close

Request the close of this transport but does not shutdown the connection itself.

2 ping

Sent by the client. Server should answer with a pong packet containing the same data

example 1. client sends: 2probe 2. server sends: 3probe

3 pong

Sent by the server to respond to ping packets.

4 message

actual message, client and server should call their callbacks with the data.

example 1

server sends: 4HelloWorld client receives and calls callback socket.on('message', function (data) { console.log(data); });

example 2

client sends: 4HelloWorld server receives and calls callback socket.on('message', function (data) { console.log(data); });

5 upgrade

Before engine.io switches a transport, it tests, if server and client can communicate over this transport. If this test succeed, the client sends an upgrade packets which requests the server to flush its cache on the old transport and switch to the new transport.

6 noop

A noop packet. Used primarily to force a poll cycle when an incoming websocket connection is received.

example

client connects through new transport client sends 2probe server receives and sends 3probe client receives and sends 5 server flushes and closes old transport and switches to new.

You can read the full documentation here

like image 101
Fabio Antunes Avatar answered Dec 29 '22 13:12

Fabio Antunes