centrifugal / centrifuge

Real-time messaging library for Go. The simplest way to add feature-rich and scalable WebSocket support to your application. The core of Centrifugo server.

Home Page:https://pkg.go.dev/github.com/centrifugal/centrifuge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom recover at connection level

bfwbbrj opened this issue · comments

commented

During my development process, I had a panic in one of my client connection (specifically, one of the callbacks) and it brought the whole application down. I believe it's essential to add some sort of recover option to enable panic recover for each connection to make sure the failure of one connection won't affect the whole application.

Hello, I am not sure about this idea. Centrifuge itself must not panic - this should be fixed ASAP. I also have this opinion regarding running applications in production. Here with Centrifuge we have a more difficult situation then with HTTP requests - connections are stateful and in most cases we don't know what to do in case of panic. This may theoretically lead to unexpected side effects.

I suppose you can add recovery logic on your app level?

commented

connections are stateful and in most cases we don't know what to do in case of panic. This may theoretically lead to unexpected side effects.

In case of panic, maybe we can just close the client that panics? This way we can ensure rest of the clients remain unaffected. Currently if this happens, all other connections are closed as well.

I suppose you can add recovery logic on your app level?

I did, but it didn't stop other clients from getting closed :/

I did, but it didn't stop other clients from getting closed :/

Could you elaborate more on this? If you added recovery then it should fully solve the case - or am I missing sth here?