NAME

Hypersonic::Protocol::WebSocket - WebSocket handshake code generation

SYNOPSIS

use Hypersonic::Protocol::WebSocket;

# Generate C code for JIT compilation
my $code = Hypersonic::Protocol::WebSocket->generate_c_code($builder);

# Perl-side testing
my $accept = Hypersonic::Protocol::WebSocket->calc_accept_key($key);
my $hs = Hypersonic::Protocol::WebSocket->parse_handshake($request);

DESCRIPTION

Implements RFC 6455 WebSocket opening handshake. All C code is generated at compile time for JIT compilation - zero runtime overhead.

RFC 6455 COMPLIANCE

  • Sec-WebSocket-Version: Only version 13 supported (returns 426 otherwise)

  • Sec-WebSocket-Accept: SHA1 + Base64 per spec

  • Sec-WebSocket-Protocol: Optional subprotocol negotiation

SEE ALSO

Hypersonic::Protocol::WebSocket::Frame for frame encoding/decoding.