Using Bun+Elysia+socket.io together

69 views Asked by At

I'm trying to build a web backend for a chat app using the runtime Bun, the library Elysia to write a REST API and the library socket.io to deliver the messages in realtime.

I went through the documentation of those 3 components, but I can't find a way to make them work together, either my GET requests are discarded by socket.io and never forwared to Elysia, or the opposite, Elysia doesn't forward the requests to socket.io.

I was trying to use the "Express" example of socket.io where they use "createServer(app)" of the http library where app is the express app, but I couldn't manage to do this for the Elysia app...

I know I could use two separate ports for the API and the socket or use Express for my REST API, but that's two options I'd like not to use.

If there is a working example for another modern router library like Hono, I could switch to another library.

Is there any documentation to do what I'm trying to do somewhere ?

Thanks !

0

There are 0 answers