We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5d3cea0 commit 8872a11Copy full SHA for 8872a11
rivetkit-typescript/packages/rivetkit/src/actor/conn-drivers.ts
@@ -83,10 +83,19 @@ export interface ConnDriver<State> {
83
const WEBSOCKET_DRIVER: ConnDriver<ConnDriverWebSocketState> = {
84
sendMessage: (
85
actor: AnyActorInstance,
86
- _conn: AnyConn,
+ conn: AnyConn,
87
state: ConnDriverWebSocketState,
88
message: CachedSerializer<protocol.ToClient>,
89
) => {
90
+ if (state.websocket.readyState !== ConnReadyState.OPEN) {
91
+ actor.rLog.warn({
92
+ msg: "attempting to send message to closed websocket, this is likely a bug in RivetKit",
93
+ connId: conn.id,
94
+ wsReadyState: state.websocket.readyState,
95
+ });
96
+ return;
97
+ }
98
+
99
const serialized = message.serialize(state.encoding);
100
101
actor.rLog.debug({
0 commit comments