Soup.websocket_server_process_handshake
Description: Reference for Soup.websocket_server_process_handshake

### Function

# Soupwebsocket_server_process_handshake

#### Declaration [src]

    gboolean
    soup_websocket_server_process_handshake (
      SoupServerMessage* msg,
      const char* expected_origin,
      char** protocols,
      GPtrArray* supported_extensions,
      GList** accepted_extensions
    )

#### Description [src]

Examines the method and request headers in `msg` and (assuming `msg` contains a valid handshake request), fills in the handshake response.

If `expected_origin` is non-`NULL`, then only requests containing a matching “Origin” header will be accepted. If `protocols` is non-`NULL`, then only requests containing a compatible “Sec-WebSocket-Protocols” header will be accepted. If `supported_extensions` is non-`NULL`, then only requests containing valid supported extensions in “Sec-WebSocket-Extensions” header will be accepted. The accepted extensions will be returned in `accepted_extensions` parameter if non-`NULL`.

This is a low-level function; if you use `soup_server_add_websocket_handler()` to handle accepting WebSocket connections, it will call this for you.

#### Parameters

`msg`

  Type: `SoupServerMessage`

  `SoupServerMessage` containing the client side of a WebSocket handshake.

  The data is owned by the caller of the function.

`expected_origin`

  Type: `const char*`

  Expected Origin header.

  The argument can be `NULL`.
  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`protocols`

  Type: An array of `char*`

  Allowed WebSocket protocols.

  The argument can be `NULL`.
  The array must be `NULL`-terminated.
  The data is owned by the caller of the function.
  Each element is a NUL terminated UTF-8 string.

`supported_extensions`

  Type: An array of `None`

  List of supported extension types.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`accepted_extensions`

  Type: A list of `None`

  A `GList` of `SoupWebsocketExtension` objects.

  The argument will be set by the function.
  The argument can be `NULL`.
  The called function takes ownership of the data, and is responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` if `msg` contained a valid WebSocket handshake request and was updated to contain a handshake response. `FALSE` if not.