a harbor for the things I love to build

AIOcean

Apps and tools I can't stop making, all docked in one place.

See what I've built

the collection

Things I couldn't stop building

Socket RPC

  • tool
  • TypeScript
  • Socket.IO

A generator that turns a TypeScript interface into typed Socket.IO RPC code for client and server.

Visit project

Linking a client and a server with socket.io means every call needs its own hand-written code: the event, the acknowledgment, the handler to clean up. After a reconnect you re-sync state yourself, and a handler registered twice can answer one acknowledgment twice.

It is a simple, typed RPC setup for socket.io, and it keeps to one stance: it writes the call bindings and leaves your socket.io setup in your hands.

A call is declared once and used from either side, and the event and acknowledgment code around it is no longer yours to maintain. You still create and configure the socket.io server and client yourself, so it suits a project that already runs socket.io or is ready to.

  • Bindings onlyIt drops into a project that already runs socket.io without redoing the connection setup. The generator emits function bindings only and does not interfere with your socket.io configuration.
  • Safe retriesA dropped connection does not leave you guessing what happened to a call. A call cut short by a disconnect resolves with code DISCONNECTED, kept apart from a server-side INTERNAL_ERROR, so you know a retry is safe.
  • Calls that endA call to a silent peer does not hang your code. Each call times out after 5000 ms by default, and you can set your own timeout or cancel it with an AbortSignal.
  • Go on the serverThe server does not have to be TypeScript. A TypeScript client talks to a Go server generated from the same contract, and the project tests the two languages against each other.

More from the harbor