GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

Search e01

One query across the encyclopedia, books, dictionary, papers, Wikidata and the developer library. Every hit carries its source.

7 results across 6 corpora for CloseEvent.

Encyclopedia 1

WebSocket

t: MessageEvent) => { console.log("Data received", event.data); ws.close(); // We got the score so we don't need the connection anymore }; ws.onclose = (event: CloseEvent) => { console.log("Connection closed", event.code, event.reason, event.wasClean); }; ws.onerror = () => { console.log("Connection closed due to error"); }; GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSoc

e01 Encyclopedia · CC BY-SA 4.0 · https://en.wikipedia.org/w/index.php?oldid=1376734210

Developer library 6

Firefox 41 release notes for developers

, Document.execCommand() when the command is not supported or enabled ([Firefox bug 1027560](https://bugzil.la/1027560)). #### Events - The non-standard `initCloseEvent()` method of the CloseEvent event and the ability to create a CloseEvent using the document.createEvent('CloseEvent') method has been removed; use the standard constructor, CloseEvent() instead ([Firefox bug 1161950](https://bugzil.la/1161950)). - O

Firefox 8 release notes for developers

PI/WebSocket) object's [`close()`](/docs/Web/API/WebSocket/close) method now matches the current draft of the standard, and close events now properly use the [`CloseEvent`](/docs/Web/API/CloseEvent) interface. - The [`WebSocket`](/docs/Web/API/WebSocket) object's `extensions` attribute is now supported. - The WebSocket constructor now supports an array of protocols as well as a single protocol string. - Mixed content

MDN Web Docs mirror · CC BY-SA 2.5 (MDN) · https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/8

WebSocket API (WebSockets)

- : Promise-based interface for connecting to a WebSocket server; uses [streams](/docs/Web/API/Streams_API) to send and receive data on the connection. - [`CloseEvent`](/docs/Web/API/CloseEvent) - : The event sent by the WebSocket object when the connection closes. - [`MessageEvent`](/docs/Web/API/MessageEvent) - : The event sent by the WebSocket object when a message is received from the server. ## Related

MDN Web Docs mirror · CC BY-SA 2.5 (MDN) · https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API

Using WebSocketStream to write a client

is safe to do so. ## Closing the connection To close a connection, call the WebSocketStream.close() method, optionally passing a [closing code](/docs/Web/API/CloseEvent/code#value) and reason: ```js wss.close({ closeCode: 4000, reason: "Night draws to a close", }); ``` > [!NOTE] > Depending on the server setup and status code you use, the server may choose to ignore a custom code in favor of a valid code that

CloseEvent

Websockets API A `CloseEvent` is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the `WebSocket` object's `onclose` attribute. ## Constructor - CloseEvent() - : Creates a new `CloseEvent`. ## Instance properties _This interface also inherits properties from its parent, Event._ - CloseEvent.code - : Returns an `unsigned short` containing the c

MDN Web Docs mirror · CC BY-SA 2.5 (MDN) · https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent

CloseEvent: reason property

Websockets API The **`reason`** read-only property of the CloseEvent interface returns the [WebSocket connection close reason](https://www.rfc-editor.org/info/rfc6455/#section-7.1.6) the server gave for closing the connection; that is, a concise human-readable prose explanation for the closure. ## Value A string. ## Examples The following example prints the value of `reason` to the console. ```js WebSocket.oncl

MDN Web Docs mirror · CC BY-SA 2.5 (MDN) · https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/reason

JSON results · Services directory