# handshake if( my $key = $ENV{HTTP_SEC_WEBSOCKET_KEY} ){ $key .= '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'; # WTF $key = Digest::SHA::sha1($key); $key = MIME::Base64::encode_base64($key); $key =~ s{\s+}{}g; print "HTTP/1.1 101 WebSocket Protocol Handshake\n"; print "Sec-WebSocket-Accept: $key\n"; print "Connection: Upgrade, Keep-Alive \n"; print "Upgrade: WebSocket\n"; }