I made a type-safe RPC + event streaming library over WebSockets
I was working with websockets and wanted some lightweight solution which was easy to work with and I never liked working with plain websockets and as an experiment I started building a typesafe solution and which is how I came up with @frsty/wsrpc . You can define procedures on the server (like trpc) , get typed send and on on the client. No codegen, no event codes objects to share between client and server, 0 runtime dependencies. Handlers are generator functions, yield events, return the RPC response: https://preview.redd.it/0igrus569n5h1.png?width=3680&format=png&auto=webp&s=880c6b2fd90a04866058bc91d703995c14482b07 All the event codes, returns and callback functions are typesafe. Works with zod, valibot, arktype, anything that implements Standard Schema. framework-agnostic. Still early so would appreciate some feedback. For detailed example see github.com/frstycodes/wsrpc submitted by /u/frstyyy [link] [留言]