MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / js_classify_receiver

Function js_classify_receiver

internal/cbm/extract_channels.c:262–295  ·  view source on GitHub ↗

Classify receiver for Socket.IO / EventEmitter / WebSocket. */

Source from the content-addressed store, hash-verified

260
261/* Classify receiver for Socket.IO / EventEmitter / WebSocket. */
262static const char *js_classify_receiver(CBMExtractCtx *ctx, TSNode object_node) {
263 char *text = cbm_node_text(ctx->arena, object_node, ctx->source);
264 if (!text) {
265 return NULL;
266 }
267 const char *tail = text;
268 const char *dot = strrchr(tail, '.');
269 if (dot) {
270 tail = dot + SKIP_ONE;
271 }
272 /* Socket.IO */
273 if (strcmp(tail, "socket") == 0 || strcmp(tail, "io") == 0 || strcmp(tail, "ws") == 0 ||
274 strcmp(tail, "client") == 0 || strcmp(tail, "server") == 0) {
275 return "socketio";
276 }
277 /* Node.js EventEmitter */
278 if (strcmp(tail, "emitter") == 0 || strcmp(tail, "eventEmitter") == 0 ||
279 strcmp(tail, "events") == 0 || strcmp(tail, "bus") == 0 || strcmp(tail, "eventBus") == 0 ||
280 strcmp(tail, "pubsub") == 0) {
281 return "event_emitter";
282 }
283 /* Kafka */
284 if (strcmp(tail, "producer") == 0) {
285 return "kafka";
286 }
287 if (strcmp(tail, "consumer") == 0) {
288 return "kafka";
289 }
290 /* RabbitMQ / AMQP */
291 if (strcmp(tail, "channel") == 0 && !strcmp(text, "channel")) {
292 return "rabbitmq";
293 }
294 return NULL;
295}
296
297/* Detect Kafka/RabbitMQ specific send/subscribe patterns. */
298static bool js_is_kafka_send(const char *method) {

Callers 1

js_process_callFunction · 0.85

Calls 1

cbm_node_textFunction · 0.85

Tested by

no test coverage detected