# mco_lews_send_websocket_closing_frame
RT

### Prototype

        MCO_RET mco_lews_send_websocket_closing_frame(lews_connection_context_h ctx);

### Arguments

`ctx`
Handle to the active connection context.

### Description

> This function sends a WebSocket close control frame to the client, initiating a graceful shutdown of the WebSocket connection as defined in RFC 6455.

> After calling this function, the application should stop sending data frames on this connection. The underlying TCP connection may be closed immediately after sending the frame or kept open briefly to receive a close frame from the peer, depending on implementation details.

>         ...
>         // Close the WebSocket connection
>         ret = mco_lews_send_websocket_closing_frame(p_ctx);
>         if (ret != MCO_S_OK) {
>             printf("mco_lews_send_websocket_closing_frame error %d\n", ret);
>             return;
>         }
>         ...

### Return Codes

`MCO_S_OK`
Close frame successfully sent to the client.
`MCO_E_NW_SENDERR`
An error occurred while transmitting the close frame over the network.

### Files

Header file:
mcoewslite.h
Source file:
mcoewslite.c
Library:
mcoewslite.a