Code Room
Code reviewHardcr-g600
Subject Websocket partial frameLevel Senior–Staff~22 minCommon in Networking & APIs · Distributed systems interviewsIndustries Software development, Technology

Question

Review this Node.js code that parses newline-delimited JSON events off a TCP socket.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewjs
socket.on('data', (chunk) => {  const line = chunk.toString('utf8').trim();  const event = JSON.parse(line);  handle(event);});
Run or narrate your approach, then ask the coach.