Enumeration

nw_ws_close_code_t

Types of codes used upon closing a WebSocket connection.

Declaration

typedef enum : unsigned int {
    ...
} nw_ws_close_code_t;

Topics

Defined Close Codes

nw_ws_close_code_normal_closure

A normal closure occurred with no errors.

nw_ws_close_code_going_away

An endpoint is no longer available, such as when a server is down.

nw_ws_close_code_protocol_error

An endpoint is terminating the connection due to a protocol error.

nw_ws_close_code_unsupported_data

An endpoint is terminating the connection because it received a type of data it cannot accept.

nw_ws_close_code_no_status_received

This value is reserved for local errors and indicates that no Close code was received.

nw_ws_close_code_abnormal_closure

This value is reserved for local errors and indicates that no Close message was received.

nw_ws_close_code_invalid_frame_payload_data

An endpoint is terminating the connection because it received data within a message that was inconsistent with the message type.

nw_ws_close_code_policy_violation

An endpoint is terminating the connection because it received a message that violates its policy.

nw_ws_close_code_message_too_big

An endpoint is terminating the connection because it received a message that is too big for it to process.

nw_ws_close_code_mandatory_extension

The WebSocket client expected the server to negotiate one or more extensions that were not negotiated.

nw_ws_close_code_internal_server_error

The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.

nw_ws_close_code_tls_handshake

This value is reserved for local errors and indicates that the TLS handshake failed.

See Also

Handling WebSocket Messages

nw_protocol_metadata_is_ws

Checks whether a metadata object represents a WebSocket message.

nw_ws_create_metadata

Initializes a WebSocket message with a specific type code.

nw_ws_metadata_get_opcode

Checks the type code on a WebSocket message.

nw_ws_opcode_t

Types of messages that you send and receive on a WebSocket connection.

nw_ws_metadata_set_close_code

Sets a close code on a WebSocket message.

nw_ws_metadata_get_close_code

Accesses the close code on a WebSocket message.

nw_ws_metadata_set_pong_handler

Sets a handler on a Ping message to be invoked when the corresponding Pong message is received.

nw_ws_pong_handler_t

A handler that indicates that a Pong message has been received for a previously sent Ping message, or that an error was encountered.

nw_ws_metadata_copy_server_response

Accesses the WebSocket server's response sent during the handshake.