dbos-inc / dbos-transact-ts

The TypeScript framework for backends that scale
https://docs.dbos.dev
MIT License
374 stars 28 forks source link

WebSocket support #648

Closed demetris-manikas closed 1 month ago

demetris-manikas commented 1 month ago

Hi. I am kind of in need of this and I am wondering whether you would be interested in a PR on the matter. There is a, seemingly not still supported, library (https://github.com/kudos/koa-websocket) which adds WebSocket support to Koa. The good thing is that the actual code is just 64 lines (https://github.com/kudos/koa-websocket/blob/master/index.js) so it can easily be adopted/modified to match dbos-transact needs.

qianl15 commented 1 month ago

Hello! We have a websocket example app here: https://github.com/dbos-inc/dbos-demo-apps/tree/main/typescript/websockets

Does it work for you?

demetris-manikas commented 1 month ago

To say the truth I missed it and I guess it works fine but I would like to be able to broadcast messages.

Since there is/are no global WebSocketServer(s) that I can work with I believe I am stuck.

My idea is to create the WSS on init according to @WebSocket declarations and go as usual. Using Kafka is not an option for me since I have not found any easy way to secure access to it.

Thanks