mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibWebSocket+RequestServer: Add a WebSocketImpl using libcurl
This implementation can be better improved in the future by ripping out a lot of the manual logic in LibWebSocket and rely on libcurl to parse our message payloads. But for now, this uses the 'raw mode' of curl websockets in connect-only mode to allow for somewhat seamless integration into our event loop.
This commit is contained in:
committed by
Andrew Kaster
parent
ad985f3227
commit
71942d53eb
@@ -42,9 +42,14 @@ void WebSocket::start()
|
||||
m_impl->on_connected = [this] {
|
||||
if (m_state != WebSocket::InternalState::EstablishingProtocolConnection)
|
||||
return;
|
||||
set_state(WebSocket::InternalState::SendingClientHandshake);
|
||||
send_client_handshake();
|
||||
drain_read();
|
||||
if (m_impl->handshake_complete_when_connected()) {
|
||||
set_state(WebSocket::InternalState::Open);
|
||||
notify_open();
|
||||
} else {
|
||||
set_state(WebSocket::InternalState::SendingClientHandshake);
|
||||
send_client_handshake();
|
||||
drain_read();
|
||||
}
|
||||
};
|
||||
m_impl->on_ready_to_read = [this] {
|
||||
drain_read();
|
||||
|
||||
Reference in New Issue
Block a user