harmony 鸿蒙net_websocket.h

2025-06-12 浏览 (1)

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

NameDescription
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.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Network Kit

harmony 鸿蒙NetConn_ConnectionProperties

harmony 鸿蒙NetConn_HttpProxy

harmony 鸿蒙NetConn_NetAddr

harmony 鸿蒙NetConn_NetCapabilities

harmony 鸿蒙NetConn_NetConnCallback

harmony 鸿蒙NetConn_NetHandle

harmony 鸿蒙NetConn_NetHandleList

harmony 鸿蒙NetConn_NetSpecifier

harmony 鸿蒙NetConn_Route

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/hGI5ld