GO-Ve01
ServicesDevelopersBooksDictionaryPapersWikidataEncyclopediaSearchBabelCareersDeck

CloseEvent

Websockets API

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 close code.
- CloseEvent.reason
- : Returns a string indicating the reason the server closed the connection. This is specific to the particular server and sub-protocol.
- CloseEvent.wasClean
- : Returns a boolean value that Indicates whether or not the connection was cleanly closed.

## Instance methods

_This interface also inherits methods from its parent, Event._

## Specifications

## Browser compatibility

## See also

- WebSocket

source: MDN Web Docs mirror · page

Cite this

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

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·