Skip to content

Commit ed6b4a2

Browse files
jukkarnashif
authored andcommitted
net: websocket: Send CLOSE back to server when received one
When zephyr receives WS CLOSE, send it back to server and close the TCP connection. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent 688bc4b commit ed6b4a2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

subsys/net/lib/websocket/websocket.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,10 @@ int websocket_recv_msg(int ws_sock, uint8_t *buf, size_t buf_len,
11041104
}
11051105
}
11061106

1107+
if (ctx->message_type == WEBSOCKET_FLAG_CLOSE) {
1108+
return websocket_internal_disconnect(ctx);
1109+
}
1110+
11071111
return payload.count;
11081112
}
11091113

0 commit comments

Comments
 (0)