Effect CommunityEC
Effect Community•3y ago•
1 reply
hsubra89

Websockets with Effect

Hey everyone. I've got a
Stream
that acts as a reducer to build a data-structure that represents a state for my domain model over time ( think Stream.scan ). When clients request data over websocket, i have to query this data-structure to return results. I'm currently not sure how to proceed beyond exposing the value within the stream into a mutable variable and then run the http/websocket logic outside effect which references that variable.

Questions =>
- Are there examples of a simple HTTP-server that's wrapped with effect?
- Any examples or insight that also involves websockets would be awesome if they exist?
- I'm assuming I would need to hold a reference to each websocket client in a Ref and then emit events as needed from the source
Stream
, but I don't have sufficient fluency with the library to figure out how exactly to structure that.

Any tips and suggestions on how to approach this problem would be really helpful 🙂.

Thank you for the great library!
Was this page helpful?