WebSocket.close()
The WebSocket.close() method closes the WebSocket connection or connection attempt, if any. If the connection is already CLOSED, this method does nothing.
Syntax
WebSocket.close();WebSocket.close(code);WebSocket.close(reason);WebSocket.close(code, reason);
Parameters
code OptionalA numeric value indicating the status code explaining why the connection is being closed. If this parameter is not specified, a default value of 1005 is assumed. See the list of status codes of CloseEvent for permitted values.reason OptionalA human-readable string explaining why the connection is closing. This string must be no longer than 123 bytes of UTF-8 text (not characters).
Exceptions thrown
INVALID_ACCESS_ERRAn invalid code was specified.SYNTAX_ERRThe reason string is too long or contains unpaired surrogates.
Note: In Gecko, this method didn't support any parameters prior to Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5).
Specifications
HTML Living Standard The definition of 'WebSocket.close()' in that specification. |
Living Standard | Initial definition |
SpecificationStatusComment
developer.mozilla.org/en-US/docs/Web/API/WebSocket/close
'Development > WebRTC' 카테고리의 다른 글
STUN, TURN, ICE (WebRTC) (0) | 2021.04.03 |
---|---|
WebRTC Issues and How to Debug Them (0) | 2021.03.18 |
Session Description Protocol (0) | 2021.03.18 |
Web APIs - CloseEvent (0) | 2021.03.18 |
[WebRTC] STUN 과 TURN 에 대하여 #1 - 개요 (0) | 2021.03.15 |