Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to keep session alive... #67

Closed
kost-g opened this issue Dec 4, 2017 · 7 comments
Closed

How to keep session alive... #67

kost-g opened this issue Dec 4, 2017 · 7 comments

Comments

@kost-g
Copy link

kost-g commented Dec 4, 2017

Please explaine how to keep session with server alive more then 1 minute?

@kost-g
Copy link
Author

kost-g commented Dec 5, 2017

It fails with code : Connection closed (1006 - Underlying connection closed) ?

@cboden
Copy link
Member

cboden commented Dec 5, 2017

Connections are automatically persistent. If the connection is severed after 1 minute my best guess is you have a proxy that is severing connections after 1 minute.

Code 1006 is ABNORMAL_CLOSE which happens when the underlying TCP connection is severed without a proper closing handshake between the client and server.

Please provide more info about your client and server if you require more help troubleshooting.

@kost-g
Copy link
Author

kost-g commented Dec 5, 2017

Maybe you are because I checked in Fiddler and response return with Header: keep-alive timeout=10 max=100

@kost-g
Copy link
Author

kost-g commented Dec 6, 2017

So as I see in FIddler WebSocket connection don't establish Probably I should add some headers for request...

@kost-g
Copy link
Author

kost-g commented Dec 6, 2017

I am using Open Server for Windows

@skecskes
Copy link

In my case I'm receiving Connection closed (1000 - ) after 1 minute. The websocket server I consume is set up in a way that it never sends pings. It sends only messages. If the client doesn't send ping after 60 seconds, the server will disconnect me. I can see in browser in developer console that some javascript client sends ping every 25 seconds and never gets disconnected.

Is there a way to set auto-ping seconds or can you show a simple example how could I send ping every 30 seconds?
Thanks

@mbonneau
Copy link
Member

@kost-g You can send a periodic ping using something like:

$loop->addPeriodicTimer(30, function () use ($conn) {
    $conn->send(new Frame('', true, Frame::OP_PING));
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants