blob: 79edc4e2cd276814073ca260a2a25193515e8693 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/*
* Copyright (c) 2022, Dex♪ <dexes.ttp@gmail.com>
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "WebSocketClientManagerLadybird.h"
#include "WebSocketImplQt.h"
#include "WebSocketLadybird.h"
namespace Ladybird {
NonnullRefPtr<WebSocketClientManagerLadybird> WebSocketClientManagerLadybird::create()
{
return adopt_ref(*new WebSocketClientManagerLadybird());
}
WebSocketClientManagerLadybird::WebSocketClientManagerLadybird() = default;
WebSocketClientManagerLadybird::~WebSocketClientManagerLadybird() = default;
RefPtr<Web::WebSockets::WebSocketClientSocket> WebSocketClientManagerLadybird::connect(AK::URL const& url, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols)
{
WebSocket::ConnectionInfo connection_info(url);
connection_info.set_origin(origin);
connection_info.set_protocols(protocols);
auto impl = adopt_ref(*new WebSocketImplQt);
auto web_socket = WebSocket::WebSocket::create(move(connection_info), move(impl));
web_socket->start();
return WebSocketLadybird::create(web_socket);
}
}
|