File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ Reference: https://socket.io/
1313 * [ How to use] ( #how-to-use )
1414 * [ With Bun's HTTP server] ( #with-buns-http-server )
1515 * [ With Hono] ( #with-hono )
16+ * [ With Elysia] ( #with-elysia )
1617 * [ Options] ( #options )
1718 * [ ` path ` ] ( #path )
1819 * [ ` pingTimeout ` ] ( #pingtimeout )
@@ -93,6 +94,34 @@ export default {
9394
9495Reference: https://hono.dev/docs/
9596
97+ ### With Elysia
98+
99+ Requires [ ` elysia@>=1.3.21 ` ] ( https://github.com/elysiajs/elysia/pull/1358 ) .
100+
101+ ``` js
102+ import { Server as Engine } from " @socket.io/bun-engine" ;
103+ import { Server } from " socket.io" ;
104+ import { Elysia } from " elysia" ;
105+
106+ const io = new Server ();
107+ const engine = new Engine ();
108+
109+ io .bind (engine);
110+
111+ io .on (" connection" , (socket ) => {
112+ // ...
113+ });
114+
115+ const app = new Elysia ()
116+ .all (' /socket.io/' , ({ request, server }) => engine .handleRequest (request, server))
117+ .listen ({
118+ port: 3000 ,
119+ ... engine .handler (),
120+ });
121+ ```
122+
123+ Reference: https://elysiajs.com/at-glance.html
124+
96125## Options
97126
98127### ` path `
You can’t perform that action at this time.
0 commit comments