mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:37:35 +00:00
LibWeb+LibWebSocket: DOM WebSocket subprotocol support
This adds support for WebSocket subprotocols to WebSocket DOM objects, with some necessary plumbing to LibWebSocket and its clients. See the associated pull request for how this was tested.
This commit is contained in:
parent
9115e99e4b
commit
230c0b34d4
19 changed files with 107 additions and 34 deletions
|
@ -37,7 +37,7 @@ public:
|
|||
Closed = 3,
|
||||
};
|
||||
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebSocket>> construct_impl(JS::Realm&, DeprecatedString const& url);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebSocket>> construct_impl(JS::Realm&, DeprecatedString const& url, Optional<Variant<DeprecatedString, Vector<DeprecatedString>>> const& protocols);
|
||||
|
||||
virtual ~WebSocket() override;
|
||||
|
||||
|
@ -66,7 +66,7 @@ private:
|
|||
void on_error();
|
||||
void on_close(u16 code, DeprecatedString reason, bool was_clean);
|
||||
|
||||
WebSocket(HTML::Window&, AK::URL&);
|
||||
WebSocket(HTML::Window&, AK::URL&, Vector<DeprecatedString> const& protocols);
|
||||
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
@ -99,6 +99,7 @@ public:
|
|||
};
|
||||
|
||||
virtual Web::WebSockets::WebSocket::ReadyState ready_state() = 0;
|
||||
virtual DeprecatedString subprotocol_in_use() = 0;
|
||||
|
||||
virtual void send(ByteBuffer binary_or_text_message, bool is_text) = 0;
|
||||
virtual void send(StringView text_message) = 0;
|
||||
|
@ -120,7 +121,7 @@ public:
|
|||
static void initialize(RefPtr<WebSocketClientManager>);
|
||||
static WebSocketClientManager& the();
|
||||
|
||||
virtual RefPtr<WebSocketClientSocket> connect(AK::URL const&, DeprecatedString const& origin) = 0;
|
||||
virtual RefPtr<WebSocketClientSocket> connect(AK::URL const&, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols) = 0;
|
||||
|
||||
protected:
|
||||
explicit WebSocketClientManager();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue