paragi / PHP-websocket-client

142 stars 61 forks source link

Add files via upload #3

Closed tsukasagenesis closed 4 years ago

tsukasagenesis commented 4 years ago

support persistant connection

paragi commented 4 years ago

Hi tsukasagenesis

Thank you for contributing to this package. I appreciate that! I will include your improvements.

Question: What is the use case? Why do you want to keep the connection open, even after the the physical connection is lost?

Comment: It's unpractical, that you deleted the whole file file and reinserted it (If that is what happened?) Github is unable to correctly identify what has changed. Please limit changes to the relevant part, in the future.

best regards Simon

tsukasagenesis commented 4 years ago

Hi paragi,

We have a HTTP API in php (php-fpm).

When we get an API call who need to be send to the websocket server (to propagate it), we just make a websocket call.

Permanent connection is keep between page, so if it's the same php-fpm process, then no new connection/handshake needed ! It just works.

you can see pfsockopen or PDO::ATTR_PERSISTENT => true for example.

Best regards

paragi commented 4 years ago

Thanks.
Good point.

Do you handle write errors on a broken connection? or just let i fail? Are you using this in production? How do you handle reset, when unpredictable errors/unreleased locks etc. occur? It seems to invite a host of problems...

What is your thoughts on making persistent connection the default?