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

Function _send_batched

dash/backends/ws.py:302–323  ·  view source on GitHub ↗

Send messages as a batch. Single messages are sent as-is. Multiple messages are wrapped in a JSON array without re-parsing - just string concatenation. Args: send_text: Async function to send text data over WebSocket messages: List of pre-serialized JSON message strings

(send_text: Callable[[str], Any], messages: list)

Source from the content-addressed store, hash-verified

300
301
302async def _send_batched(send_text: Callable[[str], Any], messages: list) -> bool:
303 """Send messages as a batch.
304
305 Single messages are sent as-is. Multiple messages are wrapped
306 in a JSON array without re-parsing - just string concatenation.
307
308 Args:
309 send_text: Async function to send text data over WebSocket
310 messages: List of pre-serialized JSON message strings
311
312 Returns:
313 True if send succeeded, False if connection was closed
314 """
315 try:
316 if len(messages) == 1:
317 await send_text(messages[0])
318 else:
319 # Wrap in array: "[msg1,msg2,msg3]"
320 await send_text("[" + ",".join(messages) + "]")
321 return True
322 except Exception: # pylint: disable=broad-exception-caught
323 return False # WebSocketDisconnect, RuntimeError, etc.
324
325
326def make_callback_done_handler(

Callers 1

_process_ws_messageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…