Skip to content

Commit

Permalink
Provide WebSocket ready state constants to follow the Web IDL definition
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaimano committed Dec 18, 2023
1 parent e52ff57 commit 2821742
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/workerd/api/web-socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,16 @@ class WebSocket: public EventTarget {
JSG_METHOD(deserializeAttachment);

JSG_STATIC_CONSTANT(READY_STATE_CONNECTING);
JSG_STATIC_CONSTANT_NAMED(CONNECTING, WebSocket::READY_STATE_CONNECTING);

JSG_STATIC_CONSTANT(READY_STATE_OPEN);
JSG_STATIC_CONSTANT_NAMED(OPEN, WebSocket::READY_STATE_OPEN);

JSG_STATIC_CONSTANT(READY_STATE_CLOSING);
JSG_STATIC_CONSTANT_NAMED(CLOSING, WebSocket::READY_STATE_CLOSING);

JSG_STATIC_CONSTANT(READY_STATE_CLOSED);
JSG_STATIC_CONSTANT_NAMED(CLOSED, WebSocket::READY_STATE_CLOSED);

// Previously, we were setting all properties as instance properties,
// which broke the ability to subclass the Event object. With the
Expand Down

0 comments on commit 2821742

Please sign in to comment.