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

Function handleServerRequest

local-cli/server/util/messageSocket.js:123–146  ·  view source on GitHub ↗
(message)

Source from the content-addressed store, hash-verified

121 }
122
123 function handleServerRequest(message) {
124 let result = null;
125 switch (message.method) {
126 case 'getid':
127 result = clientId;
128 break;
129 case 'getpeers':
130 result = {};
131 clients.forEach((otherWs, otherId) => {
132 if (clientId !== otherId) {
133 result[otherId] = url.parse(otherWs.upgradeReq.url, true).query;
134 }
135 });
136 break;
137 default:
138 throw `unkown method: ${message.method}`;
139 }
140
141 clientWs.send(JSON.stringify({
142 version: PROTOCOL_VERSION,
143 result: result,
144 id: message.id
145 }));
146 }
147
148 function forwardRequest(message) {
149 getClientWs(message.target).send(JSON.stringify({

Callers 1

attachToServerFunction · 0.85

Calls 2

parseMethod · 0.80
sendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…