net: websockets: Fix websocket close procedure
The websocket implementation did not comply with the RFC 6455 when it comes to connection close. The websocket should send in such case Close control frame. This commit fixes this behaviour. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
7f0219985d
commit
432ff20a72
|
@ -419,6 +419,12 @@ static int websocket_interal_disconnect(struct websocket_context *ctx)
|
|||
|
||||
NET_DBG("[%p] Disconnecting", ctx);
|
||||
|
||||
ret = websocket_send_msg(ctx->sock, NULL, 0, WEBSOCKET_OPCODE_CLOSE,
|
||||
true, true, SYS_FOREVER_MS);
|
||||
if (ret < 0) {
|
||||
NET_ERR("[%p] Failed to send close message (err %d).", ctx, ret);
|
||||
}
|
||||
|
||||
ret = close(ctx->real_sock);
|
||||
|
||||
websocket_context_unref(ctx);
|
||||
|
|
Loading…
Reference in New Issue