Skip to main content

OH_WebSocketClient_Constructor

Function OH_WebSocketClient_Constructor 

Source
pub unsafe extern "C" fn OH_WebSocketClient_Constructor(
    onOpen: WebSocket_OnOpenCallback,
    onMessage: WebSocket_OnMessageCallback,
    onError: WebSocket_OnErrorCallback,
    onclose: WebSocket_OnCloseCallback,
) -> *mut WebSocket
Available on crate feature api-11 only.
Expand description

Constructor of websocket.

§Arguments

  • onOpen - Callback function invoked when a connection setup message is received.

  • onMessage - Callback function invoked when a message is received.

  • onError - Callback function invoked when a connection error message is received.

  • onclose - Callback function invoked when a connection closing message is closed.

§Returns

  • Pointer to the websocket client if success; NULL otherwise.

Required System Capabilities: SystemCapability.Communication.NetStack

Available since API-level: 11

Version: 1.0