aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/webcore/WebSocket.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/webcore/WebSocket.h')
-rw-r--r--src/bun.js/bindings/webcore/WebSocket.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bun.js/bindings/webcore/WebSocket.h b/src/bun.js/bindings/webcore/WebSocket.h
index 03c0d7709..7fd4e24a7 100644
--- a/src/bun.js/bindings/webcore/WebSocket.h
+++ b/src/bun.js/bindings/webcore/WebSocket.h
@@ -103,6 +103,11 @@ public:
void didReceiveData(const char* data, size_t length);
void didReceiveBinaryData(Vector<uint8_t>&&);
+ bool hasPendingActivity() const
+ {
+ return m_state == State::OPEN || m_state == State::CLOSING || m_pendingActivityCount > 0;
+ }
+
private:
typedef union AnyWebSocket {
WebSocketClient* client;
@@ -157,6 +162,7 @@ private:
bool m_isSecure { false };
AnyWebSocket m_connectedWebSocket { nullptr };
ConnectedWebSocketKind m_connectedWebSocketKind { ConnectedWebSocketKind::None };
+ size_t m_pendingActivityCount { 0 };
bool m_dispatchedErrorEvent { false };
// RefPtr<PendingActivity<WebSocket>> m_pendingActivity;