Skip to content
This repository was archived by the owner on Sep 7, 2019. It is now read-only.

Conversation

@yura999999999
Copy link
Contributor

@yura999999999 yura999999999 commented Mar 27, 2017

Hello! First of all, tnx for Merged #95

I want to share my idea of improving the library.

The best way to check socket status(check server alive) - send clients ping:

$loop->addPeriodicTimer(mc::socketCheckInterval, function() use($client, $logger){
    $frame = WebSocketFrame::create(WebSocketOpcode::PingFrame);
    $client->sendFrame($frame);
    $logger->notice("ping");

    //DO SOMETHING
});

And receive server pong:

$client->on("pong", function($frame) use ($logger, $client){
    $logger->notice('pong');

    //DO SOMETHING
});

Also, it is very important sometimes to look at the server's response:

$client->on("pong", function($frame) use ($logger, $client){
    $logger->notice('pong');

   var_dump($frame->getData());
   var_dump($frame);
});

Maybe my suggestion needs to be improved or changed, but in the simplest form, PONG is needed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant