Closed pursonc closed 5 years ago
You can use Loop::repeat
to schedule a regularly executed callback, e.g.
Loop::repeat(30 * 1000, function () use ($connection) {
yield $connection->send(...);
});
Umm @kelunik there are some fragments of a keep-alive mechanism? I see artifacts of it (e.g. the OP_PONG handling code), but code emitting the OP_PINGs is missing?
thx keunik.if the code position below the Loop::run snippet?I have another question that how can i catch some error then reconnection
Closing this issue due to being idle for some time. v1.0.0-rc1
automatically sends ping frames after a user-definable time period if no other messages are sent, so I would recommend upgrading to that. If you have additional questions feel free to reopen this issue or open a new issue.
i suscribed the channel by sending some msg to ws server .if i want to send another msg like ‘ping’ every 30s, where should i add the code in the while loop?