mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +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:
parent
68bfb46a6f
commit
22413ef729
16 changed files with 593 additions and 1 deletions
42
Userland/Libraries/LibWeb/HTML/CloseEvent.h
Normal file
42
Userland/Libraries/LibWeb/HTML/CloseEvent.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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 CloseEvent : public DOM::Event {
|
||||
public:
|
||||
using WrapperType = Bindings::CloseEventWrapper;
|
||||
|
||||
static NonnullRefPtr<CloseEvent> create(const FlyString& event_name, bool was_clean, u16 code, const String& reason)
|
||||
{
|
||||
return adopt_ref(*new CloseEvent(event_name, was_clean, code, reason));
|
||||
}
|
||||
|
||||
virtual ~CloseEvent() override = default;
|
||||
|
||||
bool was_clean() { return m_was_clean; }
|
||||
u16 code() const { return m_code; }
|
||||
String reason() const { return m_reason; }
|
||||
|
||||
protected:
|
||||
CloseEvent(const FlyString& event_name, bool was_clean, u16 code, const String& reason)
|
||||
: Event(event_name)
|
||||
, m_was_clean(was_clean)
|
||||
, m_code(code)
|
||||
, m_reason(reason)
|
||||
{
|
||||
}
|
||||
|
||||
bool m_was_clean { false };
|
||||
u16 m_code { 0 };
|
||||
String m_reason;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue