basis-company / nats.php

nats jetstream client for php
120 stars 29 forks source link

[ question ] Client disconnect method #30

Closed oxidmod closed 3 months ago

oxidmod commented 1 year ago

Hi guys I'm wandering if there any way to close previously opened connection. Would it be useful to have a client method $client->disconnect() to unsubscribe from all subscriptions and close socket?

webspec2012 commented 1 year ago

+1

I'm trying to use the library to work under RoadRunner, but errors occur: Stale Connection, Processing timeout, after these errors I want to be able to close the old connection to create a new one, but there is no such method in the library.

At the moment, when these errors appear, I simply create a new connection, a new stream, but I consider this an incorrect use. Now I don't see such errors, but the messages don't reach NATS either now, there are no errors. While I continue to try.

nekufa commented 1 year ago

Hi @oxidemod, thanks for feedback. Yep, i agree - that looks reasonable.

Would you like to make merge request?

oxidmod commented 1 year ago

@nekufa Yeap. I'll do it ASAP

oxidmod commented 1 year ago

@nekufa looks like it isn't so easy. For correct disconnect we also have to implement drain process. It will take more time that I thought previously. I'll do it but I do not know when, sorry.

nekufa commented 1 year ago

@oxidmod never mind, it's not a problem for me.
if you need any help in implementation, feel free to contact me http://t.me/nekufa

oxidmod commented 1 year ago

@oxidmod never mind, it's not a problem for me. if you need any help in implementation, feel free to contact me http://t.me/nekufa

Thanks

nekufa commented 3 months ago

implemented by @digibeuk in 0.23 release