MCPcopy Create free account
hub / github.com/openai/plugins / handleMessage

Function handleMessage

plugins/superpowers/skills/brainstorming/scripts/server.cjs:224–238  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

222}
223
224function handleMessage(text) {
225 let event;
226 try {
227 event = JSON.parse(text);
228 } catch (e) {
229 console.error('Failed to parse WebSocket message:', e.message);
230 return;
231 }
232 touchActivity();
233 console.log(JSON.stringify({ source: 'user-event', ...event }));
234 if (event.choice) {
235 const eventsFile = path.join(STATE_DIR, 'events');
236 fs.appendFileSync(eventsFile, JSON.stringify(event) + '\n');
237 }
238}
239
240function broadcast(msg) {
241 const frame = encodeFrame(OPCODES.TEXT, Buffer.from(JSON.stringify(msg)));

Callers 1

handleUpgradeFunction · 0.85

Calls 1

touchActivityFunction · 0.85

Tested by

no test coverage detected