MCPcopy Index your code
hub / github.com/plotly/dash / send

Method send

@plotly/dash-websocket-worker/src/WebSocketManager.ts:115–138  ·  view source on GitHub ↗

* Send a message through the WebSocket connection. * If not connected, queues the message and triggers reconnection. * @param message The message to send

(message: unknown)

Source from the content-addressed store, hash-verified

113 * @param message The message to send
114 */
115 public send(message: unknown): void {
116 const data = JSON.stringify(message);
117
118 // Track activity for non-heartbeat messages
119 const msgObj = message as { type?: string };
120 if (msgObj.type !== 'heartbeat') {
121 this.lastActivityTime = Date.now();
122 }
123
124 if (this.ws && this.ws.readyState === WebSocket.OPEN) {
125 this.ws.send(data);
126 } else {
127 // Queue message for when connection is established
128 this.messageQueue.push(data);
129
130 // Trigger reconnect if we have a server URL but aren't connected/connecting
131 if (this.serverUrl && !this.isConnecting) {
132 this.isConnecting = true;
133 // Reset retry count since this is user-initiated activity
134 this.retryCount = 0;
135 this.createConnection();
136 }
137 }
138 }
139
140 /**
141 * Check if the WebSocket is currently connected.

Callers 14

_display_in_jupyterMethod · 0.80
register_commFunction · 0.80
_Function · 0.80
eFunction · 0.80
rFunction · 0.80
meFunction · 0.80
TtFunction · 0.80
plotly.min.jsFile · 0.80
handleOpenMethod · 0.80
startHeartbeatMethod · 0.80
worker.tsFile · 0.80

Calls 2

createConnectionMethod · 0.95
pushMethod · 0.80

Tested by

no test coverage detected