Soup.WebsocketConnection.close

### Method

# Soup WebsocketConnectionclose

#### Declaration [src]

    void
    soup_websocket_connection_close (
      SoupWebsocketConnection* self,
      gushort code,
      const char* data
    )

#### Description [src]

Close the connection in an orderly fashion.

Note that until the `SoupWebsocketConnection::closed` signal fires, the connection is not yet completely closed. The close message is not even sent until the main loop runs.

The `code` and `data` are sent to the peer along with the close request. If `code` is `SOUP_WEBSOCKET_CLOSE_NO_STATUS` a close message with no body (without code and data) is sent. Note that the `data` must be UTF-8 valid.

#### Parameters

`code`

  Type: `gushort`

  Close code.

`data`

  Type: `const char*`

  Close data.

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