Effect CommunityEC
Effect Community3y ago
18 replies
kayng84

Function in TypeScript

I have a function
const removeOnSocketClose = (connectionId: string, socket: WebSocket) => (ref: Ref.Ref<Map.MutableHashMap<string, WebSocket>>) => Effect.Effect<never, never, void>

Basically, I want to listen to close event on the WebSocket so I can remove it from the MutableHashMap ref.

The update MutableHashMap I can do it already, but what I should do with the socket.on('close', () => {}) ?

I try to use asyncEffect but I don't know how to work with it. I also try with Deferred but also stuck with it.

Any help are appreciate!
Was this page helpful?