SaturnFramework / Saturn

Opinionated, web development framework for F# which implements the server-side, functional MVC pattern
https://saturnframework.org
MIT License
708 stars 108 forks source link

Discussion: should channel handles have socketId as a parameter? #226

Closed robertpi closed 4 years ago

robertpi commented 4 years ago

In some cases I'd like to be able to send a reply message just to the channel that sent it. Currently the handle does not take the socketId as a parameter, so this is quite difficult.

You can store the socketId when the user connects so be able to talk to the channels that are associated with a user, but since a user could open several pages and therefore several connections, you have do way to know which of the users connections send the original messages.

robertpi commented 4 years ago

I would say the same for terminate. Seems there's no easy way to know which socket is closing.

(Although I could be missing something obvious)

robertpi commented 4 years ago

Suggested a possible implementation in this PR: https://github.com/SaturnFramework/Saturn/pull/227

Krzysztof-Cieslak commented 4 years ago

I've actually thought I've added it to handle 😅

robertpi commented 4 years ago

I definitely need access to the socket id in both handle and terminate, so we need to decide whether this merits a breaking change or not.

Krzysztof-Cieslak commented 4 years ago

Oh, yes, Saturn is still before 1.0, so breaking changes are somehow expected from time to time.

Krzysztof-Cieslak commented 4 years ago

Ok, this got merged, it will be released in next version of Saturn.