Skip to main content

websocket

Sec-Websocket-Extensions: permessage-deflate; client_max_window_bits
Sec-Websocket-Key: 3jdknZ3cA9awItgV8bJ88A==
Sec-Websocket-Version: 13
  • Sec-Websocket-Extensions
    • permessage-deflate - 启用压缩
    • client_max_window_bits - 最大压缩窗口大小
  • Sec-Websocket-Key
    • 16 字节随机值
    • 用于验证服务器正确理解 WebSocket
    • 返回 Sec-WebSocket-Accept
  • Sec-Websocket-Version
    • 13
curl \
--include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/

WebSockets over HTTP/2