Zen API

- Home
- Topics
- Types
- Files

All Classes Files Functions Variables Typedefs Friends Macros Modules Pages

kStatus kHttpServerChannel_DetachClient | ( | kHttpServerChannel | channel,
|  | kTcpClient * | client
| ) |  |

Transfers ownership of the underlying TCP client object associated with this channel.

Use this function to assume control of the channel's TCP client object. This function should only be called after formatting an HTTP response, just prior to returning from a request processing callback.

The primary purpose of this function is to support the WebSocket protocol. If a WebSocket request is received, the server can format a 101-switching-protocols response, then call this function to take control of the client for subsequent communication.

Use kObject_Destroy to free the TCP client object when it is no longer needed.

Parameters

  channel | Channel object.
  client | Receives TCP client object.

Returns
  Operation status.