今日已更新 168 条资讯 | 累计 21034 条内容
关于我们

I made a type-safe RPC + event streaming library over WebSockets

/u/frstyyy 2026年06月06日 19:10 2 次阅读 来源:Reddit r/webdev

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] [留言]

本文内容来源于互联网,版权归原作者所有
查看原文