WebSocket
Generated from idl/websockets.webidl when the site was built at 7aa23e2.
WebSocket is an interface in idl/websockets.webidl, inheriting EventTarget, exposed in Window, Worker. What it does is on MDN; this page says what niso has of it.
Platform notes
Section titled “Platform notes”Text and binary frames reach native code in the C API’s own types, a string or an ArrayBuffer, through MessageEvent.data’s native form (DECISIONS, Web platform APIs).
Status
Section titled “Status”The web features its members belong to, each with its Baseline status on the web and how much of the feature’s WPT suite passes in niso (see Web platform support).
| Feature | On the web | In niso | Members |
|---|---|---|---|
| WebSockets | Widely available | Partial 88% 756 of 857 subtests pass | 14 |
Members
Section titled “Members”constructor
Section titled “constructor”constructor(USVString url, optional (DOMString or sequence<DOMString>) protocols = []);int32_t niso_web_socket_new(niso_dom* dom, const char* url, size_t url_len, const niso_str* protocols, size_t protocols_len, niso_handle* out);Known bug: protocols that repeat in another case don’t throw SyntaxError (docs/wpt.md, Bugs the suite found).
readonly attribute USVString url;int32_t niso_web_socket_get_url(niso_dom* dom, niso_handle self, niso_str* out);CONNECTING
Section titled “CONNECTING”const unsigned short CONNECTING = 0;const unsigned short OPEN = 1;CLOSING
Section titled “CLOSING”const unsigned short CLOSING = 2;CLOSED
Section titled “CLOSED”const unsigned short CLOSED = 3;readyState
Section titled “readyState”readonly attribute unsigned short readyState;int32_t niso_web_socket_get_ready_state(niso_dom* dom, niso_handle self, uint16_t* out);bufferedAmount
Section titled “bufferedAmount”readonly attribute unsigned long long bufferedAmount;int32_t niso_web_socket_get_buffered_amount(niso_dom* dom, niso_handle self, uint64_t* out);onopen
Section titled “onopen”attribute EventHandler onopen;int32_t niso_web_socket_get_onopen(niso_dom* dom, niso_handle self, void** out);int32_t niso_web_socket_set_onopen(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);onerror
Section titled “onerror”attribute EventHandler onerror;int32_t niso_web_socket_get_onerror(niso_dom* dom, niso_handle self, void** out);int32_t niso_web_socket_set_onerror(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);onclose
Section titled “onclose”attribute EventHandler onclose;int32_t niso_web_socket_get_onclose(niso_dom* dom, niso_handle self, void** out);int32_t niso_web_socket_set_onclose(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);extensions
Section titled “extensions”readonly attribute DOMString extensions;int32_t niso_web_socket_get_extensions(niso_dom* dom, niso_handle self, niso_str* out);protocol
Section titled “protocol”readonly attribute DOMString protocol;int32_t niso_web_socket_get_protocol(niso_dom* dom, niso_handle self, niso_str* out);close()
Section titled “close()”undefined close(optional [Clamp] unsigned short code, optional USVString reason);int32_t niso_web_socket_close(niso_dom* dom, niso_handle self, bool has_code, uint16_t code, const char* reason, size_t reason_len);onmessage
Section titled “onmessage”attribute EventHandler onmessage;int32_t niso_web_socket_get_onmessage(niso_dom* dom, niso_handle self, void** out);int32_t niso_web_socket_set_onmessage(niso_dom* dom, niso_handle self, niso_event_handler_non_null_fn value_fn, void* value_userdata, niso_drop_fn value_drop);binaryType
Section titled “binaryType”attribute BinaryType binaryType;int32_t niso_web_socket_get_binary_type(niso_dom* dom, niso_handle self, niso_str* out);int32_t niso_web_socket_set_binary_type(niso_dom* dom, niso_handle self, const char* value, size_t value_len);send()
Section titled “send()”undefined send((BufferSource or USVString) data);int32_t niso_web_socket_send(niso_dom* dom, niso_handle self, const niso_buffer_or_string* data);Not in niso yet
Section titled “Not in niso yet”Members the web has, by the BCD keys web-features 3.45.0 lists, that idl/ doesn’t declare. The list is partial: web-features lists only the keys it maps to a feature.
protocol_rfc_6455(WebSockets)worker_support(WebSockets)