1# Netstack
2
3
4## Overview
5
6Provides C APIs for the network protocol stack module.
7
8**Since**: 11
9
10
11## Summary
12
13
14### File
15
16| Name| Description| 
17| -------- | -------- |
18| [net_ssl_c.h](net__ssl__c_8h.md) | Defines C APIs for the SSL/TLS certificate chain verification module.| 
19| [net_ssl_c_type.h](net__ssl__c__type_8h.md) | Defines data structures for the C APIs of the SSL/TLS certificate chain verification module.| 
20| [net_websocket.h](net__websocket_8h.md) | Defines C APIs for the WebSocket client module.| 
21| [net_websocket_type.h](net__websocket__type_8h.md) | Defines data structures for the C APIs of the WebSocket client module.| 
22
23
24### Structs
25
26| Name| Description|
27| -------- | -------- |
28| [NetStack_CertBlob](_net_stack___cert_blob.md) | Certificate data structure.|
29| [NetStack_CertificatePinning](_net_stack___certificate_pinning.md) | Data structure of the certificate lock information.|
30| [NetStack_Certificates](_net_stack___certificates.md) | Data structure of the certificate information.|
31| [WebSocket_CloseResult](_web_socket___close_result.md) | Parameters for the connection closure received by the WebSocket client. |
32| [WebSocket_CloseOption](_web_socket___close_option.md) | Parameters for the proactive connection closure initiated by the WebSocket client. |
33| [WebSocket_ErrorResult](_web_socket___error_result.md) | Parameters for the connection error received by the WebSocket client. |
34| [WebSocket_OpenResult](_web_socket___open_result.md) | Parameters for the connection success received by the WebSocket client. |
35| [WebSocket_Header](_web_socket___header.md) | Header linked list added to the WebSocket client. |
36| [WebSocket_RequestOptions](_web_socket___request_options.md) | Parameters for the connection between the WebSocket client and server. |
37| [WebSocket](_web_socket.md) | WebSocket client structure. |
38
39
40### Types
41
42| Name| Description| 
43| -------- | -------- |
44| (\* [WebSocket_OnOpenCallback](#websocket_onopencallback)) (struct [WebSocket](_web_socket.md) \*client, [WebSocket_OpenResult](_web_socket___open_result.md) openResult) | Callback invoked when the WebSocket client receives an **open** message. | 
45| (\* [WebSocket_OnMessageCallback](#websocket_onmessagecallback)) (struct [WebSocket](_web_socket.md) \*client, char \*data, uint32_t length) | Callback invoked when the WebSocket client receives data. | 
46| (\* [WebSocket_OnErrorCallback](#websocket_onerrorcallback)) (struct [WebSocket](_web_socket.md) \*client, [WebSocket_ErrorResult](_web_socket___error_result.md) errorResult) | Callback invoked when the WebSocket client receives an error message. | 
47| (\* [WebSocket_OnCloseCallback](#websocket_onclosecallback)) (struct [WebSocket](_web_socket.md) \*client, [WebSocket_CloseResult](_web_socket___close_result.md) closeResult) | Callback invoked when the WebSocket client receives a **close** message. | 
48
49### Enums
50
51| Name| Description|
52| -------- | -------- |
53| [NetStack_CertType](#netstack_certtype) { <br>NetStack_CERT_TYPE_PEM = 0, <br>NetStack_CERT_TYPE_DER = 1, <br>NetStack_CERT_TYPE_INVALID <br>} | Certificate type enums.|
54| [WebSocket_ErrCode](#websocket_errcode) {<br>WEBSOCKET_OK = 0, <br>E_BASE = 1000, <br>WEBSOCKET_CLIENT_NULL = (E_BASE + 1), <br>WEBSOCKET_CLIENT_NOT_CREATED = (E_BASE + 2),<br>WEBSOCKET_CONNECTION_ERROR = (E_BASE + 3), <br>WEBSOCKET_CONNECTION_PARSE_URL_ERROR = (E_BASE + 5),<br> WEBSOCKET_CONNECTION_NO_MEMORY = (E_BASE + 6), <br>WEBSOCKET_CONNECTION_CLOSED_BY_PEER = (E_BASE + 7),<br>WEBSOCKET_DESTROYED = (E_BASE + 8), <br>WEBSOCKET_PROTOCOL_ERROR = (E_BASE + 9), <br>WEBSOCKET_SEND_NO_MEMORY = (E_BASE + 10), <br>WEBSOCKET_SEND_DATA_NULL = (E_BASE + 11),<br>WEBSOCKET_DATA_LENGTH_EXCEEDED = (E_BASE + 12), <br>WEBSOCKET_QUEUE_LENGTH_EXCEEDED = (E_BASE + 13),<br> WEBSOCKET_NO_CLIENT_CONTEXT = (E_BASE + 14), <br>WEBSOCKET_NO_HEADER_CONTEXT = (E_BASE + 15),<br>WEBSOCKET_HEADER_EXCEEDED = (E_BASE + 16), <br>WEBSOCKET_NO_CONNECTION = (E_BASE + 17), <br>WEBSOCKET_NO_CONNECTION_CONTEXT = (E_BASE + 18)<br>} | WebSocket error codes. |
55| [NetStack_CertificatePinningKind](#netstack_certificatepinningkind) {<br>PUBLIC_KEY,<br>} | Certificate lock type.|
56| [NetStack_HashAlgorithm](#netstack_hashalgorithm) {<br>SHA_256,<br>} | Hash algorithm type.|
57
58### Functions
59
60| Name| Description|
61| -------- | -------- |
62| [OH_WebSocketClient_Constructor](#oh_websocketclient_constructor) ([WebSocket_OnOpenCallback](#websocket_onopencallback) onOpen, [WebSocket_OnMessageCallback](#websocket_onmessagecallback) onMessage, [WebSocket_OnErrorCallback](#websocket_onerrorcallback) onError, [WebSocket_OnCloseCallback](#websocket_onclosecallback) onclose) | Constructor used to create a **WebSocketClient** instance. |
63| [OH_WebSocketClient_AddHeader](#oh_websocketclient_addheader) (struct [WebSocket](_web_socket.md) \*client, struct [WebSocket_Header](_web_socket___header.md) header) | Adds the header information to the client request. |
64| [OH_WebSocketClient_Connect](#oh_websocketclient_connect) (struct [WebSocket](_web_socket.md) \*client, const char \*url, struct [WebSocket_RequestOptions](_web_socket___request_options.md) options) | Connects the client to the server. |
65| [OH_WebSocketClient_Send](#oh_websocketclient_send) (struct [WebSocket](_web_socket.md) \*client, char \*data, size_t length) | Sends data from the client to the server. |
66| [OH_WebSocketClient_Close](#oh_websocketclient_close) (struct [WebSocket](_web_socket.md) \*client, struct [WebSocket_CloseOption](_web_socket___close_option.md) options) | Lets the WebSocket client proactively close the connection. |
67| [OH_WebSocketClient_Destroy](#oh_websocketclient_destroy) (struct [WebSocket](_web_socket.md) \*client) | Releases the context and resources of the WebSocket connection. |
68| [OH_NetStack_GetPinSetForHostName](#oh_netstack_getpinsetforhostname)(const char \*hostname, [NetStack_CertificatePinning](_net_stack___certificate_pinning.md) \*pin) | Obtains the certificate lock information.|
69| [OH_NetStack_GetCertificatesForHostName](#oh_netstack_getcertificatesforhostname)(const char \*hostname, [NetStack_Certificates](_net_stack___certificates.md) \*certs) | Obtains certificate information.|
70| [OH_Netstack_DestroyCertificatesContent](#oh_netstack_destroycertificatescontent)([NetStack_Certificates](_net_stack___certificates.md) \*certs) | Releases the certificate content.|
71
72### Variables
73
74| Name| Description|
75| -------- | -------- |
76| [NetStack_CertBlob::type](#type) | Certificate type.|
77| [NetStack_CertBlob::size](#size) | Certificate content length.|
78| [NetStack_CertBlob::data](#data) | Certificate content.|
79| [NetStack_CertificatePinning::kind](#kind) | Certificate lock type.|
80| [NetStack_CertificatePinning::hashAlgorithm](#hashalgorithm) | Hash algorithm.|
81| [NetStack_CertificatePinning::publicKeyHash](#publickeyhash) | Hash value.|
82| [NetStack_Certificates::content](#content) | PEM content of the certificate.|
83| [NetStack_Certificates::length](#length) | Number of certificates.|
84| [WebSocket_CloseResult::code](#code-13) | Connection close code. |
85| [WebSocket_CloseResult::reason](#reason-13) | Connection close reason for the WebSocket client. |
86| [WebSocket_CloseOption::code](#code-23) | Connection close code. |
87| [WebSocket_CloseOption::reason](#reason-23) | Connection close reason for the WebSocket client. |
88| [WebSocket_ErrorResult::errorCode](#errorcode) | Error code. |
89| [WebSocket_ErrorResult::errorMessage](#errormessage) | Error message. |
90| [WebSocket_OpenResult::code](#code-33) | Connection success code for the WebSocket client. |
91| [WebSocket_OpenResult::reason](#reason-33) | Connection reason for the WebSocket client. |
92| [WebSocket_Header::fieldName](#fieldname) | Header field name. |
93| [WebSocket_Header::fieldValue](#fieldvalue) | Header field content. |
94| [WebSocket_Header](_web_socket___header.md) \* [WebSocket_Header::next](#next) | Next pointer of the header linked list. |
95| [WebSocket_Header](_web_socket___header.md) \* WebSocket_RequestOptions::headers | Header information.|
96| [WebSocket_OnOpenCallback](#websocket_onopencallback) [WebSocket::onOpen](#onopen) | Pointer to the callback invoked when the WebSocket client receives a connection message. |
97| [WebSocket_OnMessageCallback](#websocket_onmessagecallback) [WebSocket::onMessage](#onmessage) | Pointer to the callback invoked when the WebSocket client receives a message. |
98| [WebSocket_OnErrorCallback](#websocket_onerrorcallback) [WebSocket::onError](#onerror) | Pointer to the callback invoked when the WebSocket client receives an error message. |
99| [WebSocket_OnCloseCallback](#websocket_onclosecallback) [WebSocket::onClose](#onclose) | Pointer to the callback invoked when the WebSocket client receives a **close** message. |
100| [WebSocket_RequestOptions](_web_socket___request_options.md) [WebSocket::requestOptions](#requestoptions) | Content of the request for establishing a connection on the client.|
101
102
103## Type Description
104
105
106### WebSocket_OnCloseCallback
107
108```
109typedef void(* WebSocket_OnCloseCallback) (struct WebSocket *client, WebSocket_CloseResult closeResult)
110```
111**Description**
112Callback invoked when the WebSocket client receives a **close** message.
113
114**Since**: 11
115
116**Parameters**
117
118| Name| Description| 
119| -------- | -------- |
120| client | WebSocket client. | 
121| closeResult | Content of the close message received by the WebSocket client. | 
122
123
124### WebSocket_OnErrorCallback
125
126```
127typedef void(* WebSocket_OnErrorCallback) (struct WebSocket *client, WebSocket_ErrorResult errorResult)
128```
129**Description**
130Callback invoked when the WebSocket client receives an error message.
131
132**Since**: 11
133
134**Parameters**
135
136| Name| Description| 
137| -------- | -------- |
138| client | WebSocket client. | 
139| errorResult | Content of the error message received by the WebSocket client. | 
140
141
142### WebSocket_OnMessageCallback
143
144```
145typedef void(* WebSocket_OnMessageCallback) (struct WebSocket *client, char *data, uint32_t length)
146```
147**Description**
148Callback invoked when the WebSocket client receives data.
149
150**Since**: 11
151
152**Parameters**
153
154| Name| Description| 
155| -------- | -------- |
156| client | WebSocket client. | 
157| data | Data received by the WebSocket client. | 
158| length | Length of the data received by the WebSocket client. | 
159
160
161### WebSocket_OnOpenCallback
162
163```
164typedef void(* WebSocket_OnOpenCallback) (struct WebSocket *client, WebSocket_OpenResult openResult)
165```
166**Description**
167Callback invoked when the WebSocket client receives an **open** message.
168
169**Since**: 11
170
171**Parameters**
172
173| Name| Description| 
174| -------- | -------- |
175| client | WebSocket client. | 
176| openResult | Content of the connection setup message received by the WebSocket client. | 
177
178
179
180## Enum Description
181
182
183### NetStack_CertType
184
185```
186enum NetStack_CertType
187```
188
189**Description**
190
191Certificate type enums.
192
193**Since**: 11
194
195| Value| Description| 
196| -------- | -------- |
197| NetStack_CERT_TYPE_PEM | PEM certificate.| 
198| NetStack_CERT_TYPE_DER | DER certificate.| 
199| NetStack_CERT_TYPE_INVALID | Invalid certificate.| 
200
201
202### WebSocket_ErrCode
203
204```
205enum WebSocket_ErrCode
206```
207**Description**
208WebSocket error codes.
209
210**Since**: 11
211
212| Value| Description| 
213| -------- | -------- |
214| WEBSOCKET_OK  | Execution success.| 
215| E_BASE  | Base error code.| 
216| WEBSOCKET_CLIENT_NULL  | WebSocket is null.| 
217| WEBSOCKET_CLIENT_NOT_CREATED  | WebSocket is not created.| 
218| WEBSOCKET_CONNECTION_ERROR  | An error occurs while connecting the WebSocket client.| 
219| WEBSOCKET_CONNECTION_PARSE_URL_ERROR  | An error occurs while parsing WebSocket connection parameters.| 
220| WEBSOCKET_CONNECTION_NO_MEMORY  | The memory is insufficient for creating a context during WebSocket connection setup.| 
221| WEBSOCKET_CONNECTION_CLOSED_BY_PEER  | The WebSocket connection is closed during initialization.| 
222| WEBSOCKET_DESTROYED  | The WebSocket connection is destroyed.| 
223| WEBSOCKET_PROTOCOL_ERROR  | An incorrect protocol is used for WebSocket connection.| 
224| WEBSOCKET_SEND_NO_MEMORY  | The memory for the WebSocket client to send data is insufficient.| 
225| WEBSOCKET_SEND_DATA_NULL  | The data sent by the WebSocket client is null.| 
226| WEBSOCKET_DATA_LENGTH_EXCEEDED  | The length of the data sent by the WebSocket client exceeds the limit.| 
227| WEBSOCKET_QUEUE_LENGTH_EXCEEDED  | The queue length of the data sent by the WebSocket client exceeds the limit.| 
228| WEBSOCKET_NO_CLIENT_CONTEXT  | The context of the WebSocket client is null.| 
229| WEBSOCKET_NO_HEADER_CONTEXT  | The header of the WebSocket client is abnormal.| 
230| WEBSOCKET_HEADER_EXCEEDED  | The header of the WebSocket client exceeds the limit.| 
231| WEBSOCKET_NO_CONNECTION  | The WebSocket client is not connected.| 
232| WEBSOCKET_NO_CONNECTION_CONTEXT  | The WebSocket client does not have the connection context.| 
233
234### NetStack_CertificatePinningKind
235
236```
237enum NetStack_CertificatePinningKind
238```
239
240**Description**
241
242Enumerates certificate lock types.
243
244**Since**: 12
245
246| Value    | Description          |
247| ---------- | -------------- |
248| PUBLIC_KEY | Public key lock type.|
249
250### NetStack_HashAlgorithm
251
252```
253enum NetStack_HashAlgorithm
254```
255
256**Description**
257
258Hash algorithm.
259
260**Since**: 12
261
262| Value | Description         |
263| ------- | ------------- |
264| SHA_256 | SHA-256 algorithm.|
265
266## Function Description
267
268
269### OH_NetStack_VerifyCertification()
270
271```
272uint32_t OH_NetStack_VerifyCertification (const struct NetStack_CertBlob * cert, const struct NetStack_CertBlob * caCert )
273```
274
275**Description**
276
277Verifies the certificate chain.
278
279**System capability**: SystemCapability.Communication.NetStack
280
281**Since**: 11
282
283**Parameters**
284
285| Name| Description| 
286| -------- | -------- |
287| cert | Certificate to be verified.| 
288| caCert | Certificate specified by the user. If this parameter is left blank, the preset certificate is used for verification.| 
289
290**Returns**
291
292**0**: Success.
293
294**2305001**: Unknown error.
295
296**2305002**: Failed to obtain the issuer certificate.
297
298**2305003**: Failed to obtain the certificate revocation list (CRL).
299
300**2305004**: Failed to decrypt the certificate signature.
301
302**2305005**: Failed to decrypt the CRL signature.
303
304**2305006**: Failed to decode the issuer public key.
305
306**2305007**: Failed to sign the certificate.
307
308**2305008**: Failed to sign the CRL.
309
310**2305009**: The certificate has not taken effect.
311
312**2305010**: The certificate has expired.
313
314**2305011**: The CRL has not taken effect.
315
316**2305012**: The CRL has expired.
317
318**2305023**: The certificate has been revoked.
319
320**2305024**: The certificate authority (CA) is invalid.
321
322**2305027**: The certificate is untrusted.
323
324### OH_NetStack_GetPinSetForHostName()
325
326```
327int32_t OH_NetStack_GetPinSetForHostName (const char * hostname, NetStack_CertificatePinning * pin)
328```
329
330**Description**
331
332Obtains the certificate lock information.
333
334**System capability**: SystemCapability.Communication.NetStack
335
336**Since**: 12
337
338**Parameters**
339
340| Name    | Description                          |
341| -------- | ------------------------------ |
342| hostname | Host name.                      |
343| pin      | Structure of the certificate lock information.|
344
345**Returns**
346
347**0**: Success.
348
349**401**: Parameter error.
350
351**2305999**: Memory error.
352
353### OH_NetStack_GetCertificatesForHostName()
354
355```
356int32_t OH_NetStack_GetCertificatesForHostName(const char * hostname, NetStack_Certificates * certs)
357```
358
359**Description**
360
361Obtains the certificate information.
362
363**System capability**: SystemCapability.Communication.NetStack
364
365**Since**: 12
366
367**Parameters**
368
369| Name    | Description                      |
370| -------- | -------------------------- |
371| hostname | Host name.                  |
372| certs    | Structure of the certificate information.|
373
374**Returns**
375
376**0**: Success.
377
378**401**: Incorrect parameter settings.
379
380**2305999**: Memory error.
381
382### OH_Netstack_DestroyCertificatesContent()
383
384```
385void OH_Netstack_DestroyCertificatesContent(NetStack_Certificates * certs)
386```
387
388**Description**
389
390Releases the certificate content. If **NetStack_Certificates** is no longer used, you can call this API to release the certificate content in it to free up memory space.
391
392**System capability**: SystemCapability.Communication.NetStack
393
394**Since**: 12
395
396**Parameters**
397
398| Name | Description            |
399| ----- | ---------------- |
400| certs | Defines the certificate information structure.|
401
402### OH_WebSocketClient_AddHeader()
403
404```
405int OH_WebSocketClient_AddHeader (struct WebSocket * client, struct WebSocket_Header header )
406```
407**Description**
408Adds the header information to the client request.
409
410**System capability**: SystemCapability.Communication.NetStack
411
412**Since**: 11
413
414**Parameters**
415
416| Name| Description| 
417| -------- | -------- |
418| client | Pointer to the WebSocket client. | 
419| header | Header information. | 
420
421**Returns**
422
423Returns **0** if the operation is successful. For details about error codes, see **OH_Websocket_ErrCode**.
424
425
426
427### OH_WebSocketClient_Close()
428
429```
430int OH_WebSocketClient_Close (struct WebSocket * client, struct WebSocket_CloseOption options )
431```
432**Description**
433Lets the WebSocket client proactively close the connection.
434
435**System capability**: SystemCapability.Communication.NetStack
436
437**Since**: 11
438
439**Parameters**
440
441| Name| Description| 
442| -------- | -------- |
443| client | WebSocket client. | 
444| url | IP address for the WebSocket client to connect to the server. | 
445| options | Optional parameters for the connection closure. | 
446
447**Returns**
448
449Returns **0** if the operation is successful. For details about error codes, see **OH_Websocket_ErrCode**.
450
451**Required Permissions**
452
453ohos.permission.INTERNET
454
455
456### OH_WebSocketClient_Connect()
457
458```
459int OH_WebSocketClient_Connect (struct WebSocket * client, const char * url, struct WebSocket_RequestOptions options )
460```
461**Description**
462Connects the WebSocket client to the server.
463
464**System capability**: SystemCapability.Communication.NetStack
465
466**Since**: 11
467
468**Parameters**
469
470| Name| Description| 
471| -------- | -------- |
472| client | Pointer to the WebSocket client. | 
473| url | IP address for the WebSocket client to connect to the server. | 
474| options | Optional parameters for connection. | 
475
476**Returns**
477
478Returns **0** if the operation is successful. For details about error codes, see **OH_Websocket_ErrCode**.
479
480**Required Permissions**
481
482ohos.permission.INTERNET
483
484
485### OH_WebSocketClient_Constructor()
486
487```
488struct WebSocket* OH_WebSocketClient_Constructor (WebSocket_OnOpenCallback onOpen, WebSocket_OnMessageCallback onMessage, WebSocket_OnErrorCallback onError, WebSocket_OnCloseCallback onclose )
489```
490**Description**
491Constructor used to create a **WebSocketClient** instance.
492
493**System capability**: SystemCapability.Communication.NetStack
494
495**Since**: 11
496
497**Parameters**
498
499| Name| Description| 
500| -------- | -------- |
501| onMessage | Callback invoked when the WebSocket client receives a message. | 
502| onClose | Callback invoked when the WebSocket client receives a **close** message. | 
503| onError | Callback invoked when the WebSocket client receives an **error** message. | 
504| onOpen | Callback invoked when the WebSocket client receives an **open** message. | 
505
506**Returns**
507
508Returns the pointer to the WebSocket client if the operation is successful; returns NULL otherwise.
509
510
511
512### OH_WebSocketClient_Destroy()
513
514```
515int OH_WebSocketClient_Destroy (struct WebSocket * client)
516```
517**Description**
518Releases the context and resources of the WebSocket connection.
519
520**System capability**: SystemCapability.Communication.NetStack
521
522**Since**: 11
523
524**Parameters**
525
526| Name| Description| 
527| -------- | -------- |
528| client | WebSocket client. | 
529
530**Returns**
531
532Returns **0** if the operation is successful. For details about error codes, see **OH_Websocket_ErrCode**.
533
534**Required Permissions**
535
536ohos.permission.INTERNET
537
538
539### OH_WebSocketClient_Send()
540
541```
542int OH_WebSocketClient_Send (struct WebSocket * client, char * data, size_t length )
543```
544**Description**
545Sends data from the WebSocket client to the server.
546
547**System capability**: SystemCapability.Communication.NetStack
548
549**Since**: 11
550
551**Parameters**
552
553| Name| Description| 
554| -------- | -------- |
555| client | WebSocket client. | 
556| data | Data sent by the WebSocket client. | 
557| length | Length of the data sent by the WebSocket client. | 
558
559**Returns**
560
561 
562
563Returns **0** if the operation is successful. For details about error codes, see **OH_Websocket_ErrCode**.
564
565**Required Permissions**
566
567ohos.permission.INTERNET
568
569## Variable Description
570
571
572### data
573
574```
575uint8_t* NetStack_CertBlob::data
576```
577
578**Description**
579
580Certificate content.
581
582
583### size
584
585```
586uint32_t NetStack_CertBlob::size
587```
588
589**Description**
590
591Certificate content length.
592
593
594### type
595
596```
597enum NetStack_CertType NetStack_CertBlob::type
598```
599
600**Description**
601
602Certificate type.
603
604### kind
605
606```
607enum NetStack_CertificatePinningKind NetStack_CertificatePinning::kind
608```
609
610**Description**
611
612Certificate lock type.
613
614### hashAlgorithm
615
616```
617enum NetStack_HashAlgorithm NetStack_CertificatePinning::hashAlgorithm
618```
619
620**Description**
621
622Hash algorithm.
623
624### publicKeyHash
625
626```
627char* NetStack_CertificatePinning::publicKeyHash
628```
629
630**Description**
631
632Hash value.
633
634### content
635
636```
637char** NetStack_Certificates::content
638```
639
640**Description**
641
642PEM content of the certificate.
643
644### length
645
646```
647size_t NetStack_Certificates::length
648```
649
650**Description**
651
652Number of certificates.
653
654### code [1/3]
655
656```
657uint32_t WebSocket_CloseResult::code
658```
659
660**Description**
661
662Connection close code.
663
664
665### code [2/3]
666
667```
668uint32_t WebSocket_CloseOption::code
669```
670
671**Description**
672
673Connection close code.
674
675
676### code [3/3]
677
678```
679uint32_t WebSocket_OpenResult::code
680```
681
682**Description**
683
684Connection success code for the WebSocket client.
685
686
687### errorCode
688
689```
690uint32_t WebSocket_ErrorResult::errorCode
691```
692
693**Description**
694
695Error code.
696
697
698### errorMessage
699
700```
701const char* WebSocket_ErrorResult::errorMessage
702```
703
704**Description**
705
706Error message.
707
708
709### fieldName
710
711```
712const char* WebSocket_Header::fieldName
713```
714
715**Description**
716
717Header field name.
718
719
720### fieldValue
721
722```
723const char* WebSocket_Header::fieldValue
724```
725
726**Description**
727
728Header field content.
729
730
731### next
732
733```
734struct WebSocket_Header* WebSocket_Header::next
735```
736
737**Description**
738
739Next pointer of the header linked list.
740
741
742### onClose
743
744```
745WebSocket_OnCloseCallback WebSocket::onClose
746```
747
748**Description**
749
750Pointer to the callback invoked when the WebSocket client receives a close message.
751
752
753### onError
754
755```
756WebSocket_OnErrorCallback WebSocket::onError
757```
758
759**Description**
760
761Pointer to the callback invoked when the WebSocket client receives an error message.
762
763
764### onMessage
765
766```
767WebSocket_OnMessageCallback WebSocket::onMessage
768```
769
770**Description**
771
772Pointer to the callback invoked when the WebSocket client receives a message.
773
774
775### onOpen
776
777```
778WebSocket_OnOpenCallback WebSocket::onOpen
779```
780
781**Description**
782
783Pointer to the callback invoked when the WebSocket client receives a connection message.
784
785
786### reason [1/3]
787
788```
789const char* WebSocket_CloseResult::reason
790```
791
792**Description**
793
794Connection close reason for the WebSocket client.
795
796
797### reason [2/3]
798
799```
800const char* WebSocket_CloseOption::reason
801```
802
803**Description**
804
805Connection close reason for the WebSocket client.
806
807
808### reason [3/3]
809
810```
811const char* WebSocket_OpenResult::reason
812```
813
814**Description**
815
816Connection reason for the WebSocket client.
817
818
819### requestOptions
820
821```
822WebSocket_RequestOptions WebSocket::requestOptions
823```
824
825**Description**
826
827Options of the connection request.
828