Discuss this help topic in SecureBlackbox Forum

TElWebSocketBase.CreateWebSocketAccept

TElWebSocketBase     See also     


Filter: C#/Java  VB.NET  Pascal  C++  PHP  


Generates the content of the header field used to initiate WebSocket handshake on server's side.

Declaration

[C#/Java]
    static string CreateWebSocketAccept(string Key);

[VB.NET]
    Shared Function CreateWebSocketAccept(ByVal Key As String) As String

[Pascal]
    class function CreateWebSocketAccept(const Key : string) : string;

[C++]
    static void CreateWebSocketAccept(const std::string &Key, std::string &OutResult);

[PHP]
    string CreateWebSocketAccept(string $Key)

Parameters

  • Key - the contents of the Sec-WebSocket-Key field (randomly generated by a client).

Return value

    Returns the string containing the Sec-WebSocket-Accept value.

Description

    According to RFC 6455, a WebSocket client's handshake is just an HTTP Upgrade request. The client's handshake request should contain the Sec-WebSocket-Key header field containing a randomly generated 16-byte value. To accept the handhsake, the server generates a Sec-WebSocket-Accept header field basing on the received Sec-WebSocket-Key value. Use this method to generate the value of the Sec-WebSocket-Accept field of the server's handshake response.

See also:     Close     Constructor    

Discuss this help topic in SecureBlackbox Forum