indexCliente en TypeScript#client#typescript#websocket
Esta nota todavía no está traducida, así que se muestra la fuente en inglés.

Client in TypeScript

The same wire protocol as client-in-c, implemented in the author's actual working stack, either on Node or directly in the browser against the native WebSocket API. This branch is the deliberate other half of the comparison this atlas is built around: automatic reconnection, out-of-order message handling, and — the real point — a line-by-line accounting of what a high-level runtime hands you for free (framing, backpressure, UTF-8 validation, the entire frame-parsing layer) against what the C client had to build by hand, and what control gets traded away in exchange.

Planned notes

  • Deciding Node vs browser WebSocket for this client, and what changes about the protocol handling either way
  • Everything the runtime's WebSocket object already does that client-in-c implemented from scratch: framing, masking, fragmentation reassembly, UTF-8 validation
  • Automatic reconnection with backoff, and how much of client-in-c's reconnection logic collapses into a few lines here
  • Handling out-of-order or duplicate messages arriving after a reconnect
  • Modeling client state (current room, presence list, message history) idiomatically in TypeScript vs the C client's structs
  • A minimal terminal or browser UI for the same feature set as the C client, for a fair side-by-side
  • Where the high-level runtime's abstraction leaks: the moments it still forces you to think about framing or backpressure
  • A direct, itemized comparison: lines of code, what's hidden, what's still your responsibility, in C vs TypeScript, for the identical protocol
  • Type-safety on the wire: encoding the custom binary protocol / WebSocket message schema as TypeScript types, and what that buys you that C's structs don't

Core sources

  • MDN, WebSocket API — the native browser reference this client is built against (or Node's equivalent lifecycle) without adopting a full client library.
  • ws (Node) documentation — referenced only for expected behavior, not used as a dependency; the point is writing the client by hand over the protocol.
  • RFC 6455 — the same spec as client-in-c, read again from the "what does the runtime already do for me" angle.

Connects to: Client in C · WebSocket Protocol from Scratch