net_websocket.h
Overview
Defines C APIs for the WebSocket client module.
Library: libnet_websocket.so
System capability: SystemCapability.Communication.NetStack
Since: 11
Related module: Netstack
Summary
Functions
Name | Description |
---|---|
OH_WebSocketClient_Constructor (WebSocket_OnOpenCallback onOpen, WebSocket_OnMessageCallback onMessage, WebSocket_OnErrorCallback onError, WebSocket_OnCloseCallback onclose) | Constructor used to create a WebSocketClient instance. |
OH_WebSocketClient_AddHeader (struct WebSocket *client, struct WebSocket_Header header) | Adds the header information to the client request. |
OH_WebSocketClient_Connect (struct WebSocket *client, const char *url, struct WebSocket_RequestOptions options) | Connects the WebSocket client to the server. |
OH_WebSocketClient_Send (struct WebSocket *client, char *data, size_t length) | Sends data from the WebSocket client to the server. |
OH_WebSocketClient_Close (struct WebSocket *client, struct WebSocket_CloseOption options) | Lets the WebSocket client proactively close the connection. |
OH_WebSocketClient_Destroy (struct WebSocket *client) | Releases the context and resources of the WebSocket connection. |