Más contenido relacionado
La actualidad más candente (20)
Similar a Web sockets (20)
Web sockets
- 4. Upgrade I
Request Response
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept <accept>
Sec-WebSocket-Protocol: <prot1>
GET /<endpoint> HTTP 1.1
Host: example.org
Upgrade: websocket
Connection: Upgrade
Origin: example.org
Sec-WebSocket-Accept <key>
Sec-WebSocket-Version: 13
Sec-WebSocket-Protocol: <prot1>
- 6. Frame I
Head Payload
RSV, Opcode
1 Byte
Masked, Length I
1 Byte
Length II
2 Byte
Masking
4 Byte
Length III
8 Byte
Opcodes: Continuation (0x00), Text (0x01), Binary (0x02), Close (0x08), Ping (0x09), Pong (0x0a)
- 7. Frame II
Length
7 Bit
Length I
< 0x7e
Length II
= 0x7e
Length III
= 0x7f
Masked
for (var i = 0; i < b.length; i++) {
b[i] = b[i] ^ m[i % 4]
}