webSocketAccept function

String webSocketAccept(
  1. String key
)

The Sec-WebSocket-Accept value for a Sec-WebSocket-Key key (RFC 6455 ยง4.2.2): the base64 SHA-1 of the key and the protocol's GUID.

The server sends it in its handshake answer, and the client checks it.

Implementation

String webSocketAccept(String key) => base64.encode(
  _sha1(ascii.encode('${key}258EAFA5-E914-47DA-95CA-C5AB0DC85B11')),
);