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.<br>**File to include**: \<network\/netstack\/net_ssl\/net_ssl_c.h\>| 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. **File to include**: \<network\/netstack\/net_ssl\/net_ssl_c_type.h\>| 20| [net_websocket.h](net__websocket_8h.md) | Defines C APIs for the WebSocket client module. **File to include**: \<network\/netstack\/net_websocket.h\>| 21| [net_websocket_type.h](net__websocket__type_8h.md) | Defines data structures for the C APIs of the WebSocket client module. **File to include**: \<network\/net_websocket_type.h\>| 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_CertVerification() 270 271``` 272uint32_t OH_NetStack_CertVerification(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**2305069**: A call error occurred during certificate verification or the parameter is invalid. 325 326### OH_NetStack_GetPinSetForHostName() 327 328``` 329int32_t OH_NetStack_GetPinSetForHostName (const char * hostname, NetStack_CertificatePinning * pin) 330``` 331 332**Description** 333 334Obtains the certificate lock information. 335 336**System capability**: SystemCapability.Communication.NetStack 337 338**Since**: 12 339 340**Parameters** 341 342| Name | Description | 343| -------- | ------------------------------ | 344| hostname | Host name. | 345| pin | Structure of the certificate lock information.| 346 347**Returns** 348 349**0**: Success. 350 351**401**: Parameter error. 352 353**2305999**: Memory error. 354 355### OH_NetStack_GetCertificatesForHostName() 356 357``` 358int32_t OH_NetStack_GetCertificatesForHostName(const char * hostname, NetStack_Certificates * certs) 359``` 360 361**Description** 362 363Obtains the certificate information. 364 365**System capability**: SystemCapability.Communication.NetStack 366 367**Since**: 12 368 369**Parameters** 370 371| Name | Description | 372| -------- | -------------------------- | 373| hostname | Host name. | 374| certs | Structure of the certificate information.| 375 376**Returns** 377 378**0**: Success. 379 380**401**: Parameter error. 381 382**2305999**: Memory error. 383 384### OH_Netstack_DestroyCertificatesContent() 385 386``` 387void OH_Netstack_DestroyCertificatesContent(NetStack_Certificates * certs) 388``` 389 390**Description** 391 392Releases 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. 393 394**System capability**: SystemCapability.Communication.NetStack 395 396**Since**: 12 397 398**Parameters** 399 400| Name | Description | 401| ----- | ---------------- | 402| certs | Defines the certificate information structure.| 403 404### OH_WebSocketClient_AddHeader() 405 406``` 407int OH_WebSocketClient_AddHeader (struct WebSocket * client, struct WebSocket_Header header ) 408``` 409**Description** 410Adds the header information to the client request. 411 412**System capability**: SystemCapability.Communication.NetStack 413 414**Since**: 11 415 416**Parameters** 417 418| Name| Description| 419| -------- | -------- | 420| client | Pointer to the WebSocket client. | 421| header | Header information. | 422 423**Returns** 424 425Returns **0** if the operation is successful. For details about error codes, see **OH_Websocket_ErrCode**. 426 427 428 429### OH_WebSocketClient_Close() 430 431``` 432int OH_WebSocketClient_Close (struct WebSocket * client, struct WebSocket_CloseOption options ) 433``` 434**Description** 435Lets the WebSocket client proactively close the connection. 436 437**System capability**: SystemCapability.Communication.NetStack 438 439**Since**: 11 440 441**Parameters** 442 443| Name| Description| 444| -------- | -------- | 445| client | WebSocket client. | 446| url | IP address for the WebSocket client to connect to the server. | 447| options | Optional parameters for the connection closure. | 448 449**Returns** 450 451Returns **0** if the operation is successful. For details about error codes, see **OH_Websocket_ErrCode**. 452 453**Required Permissions** 454 455ohos.permission.INTERNET 456 457 458### OH_WebSocketClient_Connect() 459 460``` 461int OH_WebSocketClient_Connect (struct WebSocket * client, const char * url, struct WebSocket_RequestOptions options ) 462``` 463**Description** 464Connects the WebSocket client to the server. 465 466**System capability**: SystemCapability.Communication.NetStack 467 468**Since**: 11 469 470**Parameters** 471 472| Name| Description| 473| -------- | -------- | 474| client | Pointer to the WebSocket client. | 475| url | IP address for the WebSocket client to connect to the server. | 476| options | Optional parameters for connection. | 477 478**Returns** 479 480Returns **0** if the operation is successful. For details about error codes, see **OH_Websocket_ErrCode**. 481 482**Required Permissions** 483 484ohos.permission.INTERNET 485 486 487### OH_WebSocketClient_Constructor() 488 489``` 490struct WebSocket* OH_WebSocketClient_Constructor (WebSocket_OnOpenCallback onOpen, WebSocket_OnMessageCallback onMessage, WebSocket_OnErrorCallback onError, WebSocket_OnCloseCallback onclose ) 491``` 492**Description** 493Constructor used to create a **WebSocketClient** instance. 494 495**System capability**: SystemCapability.Communication.NetStack 496 497**Since**: 11 498 499**Parameters** 500 501| Name| Description| 502| -------- | -------- | 503| onMessage | Callback invoked when the WebSocket client receives a message. | 504| onClose | Callback invoked when the WebSocket client receives a **close** message. | 505| onError | Callback invoked when the WebSocket client receives an **error** message. | 506| onOpen | Callback invoked when the WebSocket client receives an **open** message. | 507 508**Returns** 509 510Returns the pointer to the WebSocket client if the operation is successful; returns NULL otherwise. 511 512 513### OH_WebSocketClient_Destroy() 514 515``` 516int OH_WebSocketClient_Destroy (struct WebSocket * client) 517``` 518**Description** 519Releases the context and resources of the WebSocket connection. 520 521**System capability**: SystemCapability.Communication.NetStack 522 523**Since**: 11 524 525**Parameters** 526 527| Name| Description| 528| -------- | -------- | 529| client | WebSocket client. | 530 531**Returns** 532 533Returns **0** if the operation is successful. For details about error codes, see **OH_Websocket_ErrCode**. 534 535**Required Permissions** 536 537ohos.permission.INTERNET 538 539 540### OH_WebSocketClient_Send() 541 542``` 543int OH_WebSocketClient_Send (struct WebSocket * client, char * data, size_t length ) 544``` 545**Description** 546Sends data from the WebSocket client to the server. 547 548**System capability**: SystemCapability.Communication.NetStack 549 550**Since**: 11 551 552**Parameters** 553 554| Name| Description| 555| -------- | -------- | 556| client | WebSocket client. | 557| data | Data sent by the WebSocket client. | 558| length | Length of the data sent by the WebSocket client. | 559 560**Returns** 561 562Returns **0** if the operation is successful. For details about error codes, see **OH_Websocket_ErrCode**. 563 564**Required Permissions** 565 566ohos.permission.INTERNET 567 568## Variable Description 569 570 571### data 572 573``` 574uint8_t* NetStack_CertBlob::data 575``` 576 577**Description** 578 579Certificate content. 580 581 582### size 583 584``` 585uint32_t NetStack_CertBlob::size 586``` 587 588**Description** 589 590Certificate content length. 591 592 593### type 594 595``` 596enum NetStack_CertType NetStack_CertBlob::type 597``` 598 599**Description** 600 601Certificate type. 602 603### kind 604 605``` 606enum NetStack_CertificatePinningKind NetStack_CertificatePinning::kind 607``` 608 609**Description** 610 611Certificate lock type. 612 613### hashAlgorithm 614 615``` 616enum NetStack_HashAlgorithm NetStack_CertificatePinning::hashAlgorithm 617``` 618 619**Description** 620 621Hash algorithm. 622 623### publicKeyHash 624 625``` 626char* NetStack_CertificatePinning::publicKeyHash 627``` 628 629**Description** 630 631Hash value. 632 633### content 634 635``` 636char** NetStack_Certificates::content 637``` 638 639**Description** 640 641PEM content of the certificate. 642 643### length 644 645``` 646size_t NetStack_Certificates::length 647``` 648 649**Description** 650 651Number of certificates. 652 653### code [1/3] 654 655``` 656uint32_t WebSocket_CloseResult::code 657``` 658 659**Description** 660 661Connection close code. 662 663 664### code [2/3] 665 666``` 667uint32_t WebSocket_CloseOption::code 668``` 669 670**Description** 671 672Connection close code. 673 674 675### code [3/3] 676 677``` 678uint32_t WebSocket_OpenResult::code 679``` 680 681**Description** 682 683Connection success code for the WebSocket client. 684 685 686### errorCode 687 688``` 689uint32_t WebSocket_ErrorResult::errorCode 690``` 691 692**Description** 693 694Error code. 695 696 697### errorMessage 698 699``` 700const char* WebSocket_ErrorResult::errorMessage 701``` 702 703**Description** 704 705Error message. 706 707 708### fieldName 709 710``` 711const char* WebSocket_Header::fieldName 712``` 713 714**Description** 715 716Header field name. 717 718 719### fieldValue 720 721``` 722const char* WebSocket_Header::fieldValue 723``` 724 725**Description** 726 727Header field content. 728 729 730### next 731 732``` 733struct WebSocket_Header* WebSocket_Header::next 734``` 735 736**Description** 737 738Next pointer of the header linked list. 739 740 741### onClose 742 743``` 744WebSocket_OnCloseCallback WebSocket::onClose 745``` 746 747**Description** 748 749Pointer to the callback invoked when the WebSocket client receives a close message. 750 751 752### onError 753 754``` 755WebSocket_OnErrorCallback WebSocket::onError 756``` 757 758**Description** 759 760Pointer to the callback invoked when the WebSocket client receives an error message. 761 762 763### onMessage 764 765``` 766WebSocket_OnMessageCallback WebSocket::onMessage 767``` 768 769**Description** 770 771Pointer to the callback invoked when the WebSocket client receives a message. 772 773 774### onOpen 775 776``` 777WebSocket_OnOpenCallback WebSocket::onOpen 778``` 779 780**Description** 781 782Pointer to the callback invoked when the WebSocket client receives a connection message. 783 784 785### reason [1/3] 786 787``` 788const char* WebSocket_CloseResult::reason 789``` 790 791**Description** 792 793Connection close reason for the WebSocket client. 794 795 796### reason [2/3] 797 798``` 799const char* WebSocket_CloseOption::reason 800``` 801 802**Description** 803 804Connection close reason for the WebSocket client. 805 806 807### reason [3/3] 808 809``` 810const char* WebSocket_OpenResult::reason 811``` 812 813**Description** 814 815Connection reason for the WebSocket client. 816 817 818### requestOptions 819 820``` 821WebSocket_RequestOptions WebSocket::requestOptions 822``` 823 824**Description** 825 826Options of the connection request. 827