1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:38:12 +00:00

LibWeb: Add WebSocket bindings

The WebSocket bindings match the original specification from the
WHATWG living standard, but do not match the later update of the
standard that involves FETCH. The FETCH update will be handled later
since the changes would also affect XMLHttpRequest.
This commit is contained in:
DexesTTP 2021-04-24 13:54:24 +02:00 committed by Linus Groh
parent 68bfb46a6f
commit 22413ef729
16 changed files with 593 additions and 1 deletions

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2021, Dex <dexes.ttp@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/DOM/Event.h>
namespace Web::HTML {
class MessageEvent : public DOM::Event {
public:
using WrapperType = Bindings::MessageEventWrapper;
static NonnullRefPtr<MessageEvent> create(const FlyString& event_name, const String& data, const String& origin)
{
return adopt_ref(*new MessageEvent(event_name, data, origin));
}
virtual ~MessageEvent() override = default;
const String& data() const { return m_data; }
const String& origin() const { return m_origin; }
protected:
MessageEvent(const FlyString& event_name, const String& data, const String& origin)
: DOM::Event(event_name)
, m_data(data)
, m_origin(origin)
{
}
String m_data;
String m_origin;
};
}