philippseith / signalr

SignalR server and client in go
MIT License
131 stars 39 forks source link

feat: add Stop() function #166

Closed sruehl closed 1 year ago

sruehl commented 1 year ago

This is a convenience function utilizing cancel function.

Solves https://github.com/philippseith/signalr/issues/80

philippseith commented 1 year ago

I don't think that Stop is necessary, as stopping is possible by canceling the context given to NewClient (and this is already well-documented). Adding Stop does add a second way to stop the client loop, which might cause misunderstandings. Furthermore the codebase grows without adding new functionality or improving other properties. What are your reasons for adding Stop?

sruehl commented 1 year ago

It is confusing to have a Start() without a Stop(). Other than that you would need to keep/store a pointer to the cancel function when it would be sufficient to call a function on the client itself. It is so to say just a convenience method to not having to store the function and being able to just Stop() the client. Other than that you said "PR welcome" here https://github.com/philippseith/signalr/issues/80#issuecomment-958061026