diff options
author | 2022-06-17 20:29:56 -0700 | |
---|---|---|
committer | 2022-06-22 06:56:47 -0700 | |
commit | 71025c8bcc68929cea2260d92de03e20a3c898d2 (patch) | |
tree | 8dd26d232c82e986a2e775abfb89178b02359596 /src/javascript/jsc/bindings/webcore/WebSocket.h | |
parent | 89f08aae2736182bc681446cab631014f51978a7 (diff) | |
download | bun-71025c8bcc68929cea2260d92de03e20a3c898d2.tar.gz bun-71025c8bcc68929cea2260d92de03e20a3c898d2.tar.zst bun-71025c8bcc68929cea2260d92de03e20a3c898d2.zip |
Fix most of the errors
Diffstat (limited to 'src/javascript/jsc/bindings/webcore/WebSocket.h')
-rw-r--r-- | src/javascript/jsc/bindings/webcore/WebSocket.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/javascript/jsc/bindings/webcore/WebSocket.h b/src/javascript/jsc/bindings/webcore/WebSocket.h index 73a6d8ca0..b75bc346c 100644 --- a/src/javascript/jsc/bindings/webcore/WebSocket.h +++ b/src/javascript/jsc/bindings/webcore/WebSocket.h @@ -70,7 +70,8 @@ public: CONNECTING = 0, OPEN = 1, CLOSING = 2, - CLOSED = 3 + CLOSED = 3, + }; ExceptionOr<void> connect(const String& url); @@ -100,12 +101,16 @@ public: using RefCounted::deref; using RefCounted::ref; + void didConnect(); + void didClose(unsigned unhandledBufferedAmount, ClosingHandshakeCompletionStatus, unsigned short code, const String& reason); + void didConnect(us_socket_t* socket, char* bufferedData, size_t bufferedDataSize); + void didFailToConnect(int32_t code); private: typedef union AnyWebSocket { uWS::WebSocket<false, false, WebSocket*>* client; - uWS::WebSocket<false, true, WebSocket*>* clientSSL; - uWS::WebSocket<true, false, WebSocket*>* server; + uWS::WebSocket<true, false, WebSocket*>* clientSSL; + uWS::WebSocket<false, true, WebSocket*>* server; uWS::WebSocket<true, true, WebSocket*>* serverSSL; } AnyWebSocket; enum ConnectedWebSocketKind { @@ -117,6 +122,7 @@ private: }; explicit WebSocket(ScriptExecutionContext&); + explicit WebSocket(ScriptExecutionContext&, const String& url); void dispatchErrorEventIfNeeded(); @@ -131,16 +137,14 @@ private: void refEventTarget() final { ref(); } void derefEventTarget() final { deref(); } - void didConnect(); void didReceiveMessage(String&& message); void didReceiveData(const char* data, size_t length); void didReceiveBinaryData(Vector<uint8_t>&&); - void didReceiveMessageError(String&& reason); + void didReceiveMessageError(WTF::StringImpl::StaticStringImpl* reason); void didUpdateBufferedAmount(unsigned bufferedAmount); void didStartClosingHandshake(); - void didClose(unsigned unhandledBufferedAmount, ClosingHandshakeCompletionStatus, unsigned short code, const String& reason); - void didConnect(us_socket_t* socket, char* bufferedData, size_t bufferedDataSize); - void didFailToConnect(int32_t code); + + template<bool isBinary> void sendWebSocketData(const char* data, size_t length); void failAsynchronously(); |