• Skip to main content
  • Skip to search
  • Skip to select language
    • Technologies Overview
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs
    • Browser Extensions
    • MathML
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
    • Send Feedback
    • Contribute to MDN
    • Report a content issue 🌐
    • Report a platform issue 🌐
  1. Web technology for developers
  2. Web APIs
  3. CloseEvent
  4. CloseEvent.wasClean

Table of contents

  • Value
  • Examples
  • Specifications
  • Browser compatibility

CloseEvent.wasClean

The wasClean read-only property of the CloseEvent interface returns true if the connection closed cleanly.

Value

A Boolean. True if the connection closed cleanly, false otherwise.

Examples

The following example prints the value of wasClean to the console.

WebSocket.onclose = function(event) {
  console.log(event.wasClean);
};

Specifications

Specification
HTML Standard
# dom-closeevent-wasclean-dev

Browser compatibility

BCD tables only load in the browser

Found a problem with this page?

  • Edit on GitHub
  • Source on GitHub
  • Report a problem with this content on GitHub
  • Want to fix the problem yourself? See our Contribution guide.

Last modified: Mar 30, 2022, by MDN contributors

Related Topics

  1. Websockets API
  2. CloseEvent
  3. Constructor
    1. CloseEvent()
  4. Properties
    1. code
    2. reason
    3. wasClean
  5. Methods
    1. initCloseEvent()
  6. Inheritance:
    1. Event
  7. Related pages for Websockets API
    1. MessageEvent
    2. WebSocket
  • Web Technologies
  • Learn Web Development
  • About MDN
  • Feedback
  • About
  • MDN Web Docs Store
  • Contact Us
  • Firefox

MDN

  • MDN on Twitter
  • MDN on Github

Mozilla

  • Mozilla on Twitter
  • Mozilla on Instagram

© 2005-2022 Mozilla and individual contributors. Content is available under these licenses.

  • Terms
  • Privacy
  • Cookies