MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / parse_msg_json

Function parse_msg_json

crates/cli/src/subcommands/subscribe.rs:443–449  ·  view source on GitHub ↗

Parse a v1 text websocket message as JSON.

(msg: &WsMessage)

Source from the content-addressed store, hash-verified

441
442/// Parse a v1 text websocket message as JSON.
443fn parse_msg_json(msg: &WsMessage) -> Option<ws_v1::ServerMessage<ws_v1::JsonFormat>> {
444 let WsMessage::Text(msg) = msg else { return None };
445 serde_json::from_str::<DeserializeWrapper<ws_v1::ServerMessage<ws_v1::JsonFormat>>>(msg)
446 .inspect_err(|e| eprintln!("couldn't parse message from server: {e}"))
447 .map(|wrapper| wrapper.0)
448 .ok()
449}
450
451/// Await the initial v1 [`ws_v1::ServerMessage::InitialSubscription`].
452/// If `module_def` is `Some`, print a JSON representation to stdout.

Callers 2

await_initial_update_v1Function · 0.85

Calls 2

okMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…