CloseEventData

CloseEventData = ({int code, String reason})

WebSocket close event data containing the close code and reason.

Close codes follow RFC 6455:

  • 1000: Normal closure - connection completed its purpose

  • 1001: Going away - server shutdown or browser navigating away

  • 1002: Protocol error

  • 1006: Abnormal closure - no close frame received

  • 1011: Internal error

  • 3000-3999: Library/framework codes (IANA registered)

  • 4000-4999: Private use codes

  • CloseEvent.code (MDN)

  • CloseEvent (MDN)

Implementation

typedef CloseEventData = ({
  /// The close code (1000-4999) indicating why the connection closed.
  int code,

/// A human-readable explanation of why the connection was closed. String reason, });