MCPcopy Create free account
hub / github.com/ptmt/react-native-macos / parseMessage

Function parseMessage

local-cli/server/util/messageSocket.js:15–31  ·  view source on GitHub ↗
(data, binary)

Source from the content-addressed store, hash-verified

13const PROTOCOL_VERSION = 2;
14
15function parseMessage(data, binary) {
16 if (binary) {
17 console.error('Expected text message, got binary!');
18 return undefined;
19 }
20 try {
21 const message = JSON.parse(data);
22 if (message.version === PROTOCOL_VERSION) {
23 return message;
24 }
25 console.error('Received message had wrong protocol version: '
26 + message.version);
27 } catch (e) {
28 console.error('Failed to parse the message as JSON:\n' + data);
29 }
30 return undefined;
31}
32
33function isBroadcast(message) {
34 return (

Callers 2

attachToServerFunction · 0.85
constructorMethod · 0.85

Calls 2

parseMethod · 0.80
errorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…