menu_book Course Curriculum (Bun) expand_more
Runtime Basics
Package Manager
Scripts & Tooling
Files & Streams
HTTP & Web APIs
SQLite & Data
Testing
Server WebSocket
Learn Server WebSocket in Bun with a focused explanation, a topic-specific example, edge guidance, and a mastery check.
12 min read
•
Intermediate
Advertisement
bun-048.ts
ts
Bun.serve({websocket:{open(ws){ws.send("connected");},message(ws,msg){ws.send(`echo:${msg}`);}},fetch(req,s){return s.upgrade(req)?undefined:new Response("ws only",{status:426});}});
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content