Skip to content

Commit

Permalink
Fix heartbeat
Browse files Browse the repository at this point in the history
  • Loading branch information
calcinai committed Dec 1, 2015
1 parent 4d56281 commit 3aae0fd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/Protocol/AbstractProtocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,15 @@ public function onHeartbeat(){
$this->heartbeat_timer->cancel();
}

//Set a new timeout (1 sec seems reasonable)
$this->heartbeat_timer = $this->client->getLoop()->addTimer(2, function(){
$this->stream->close();
throw new ConnectionLostException();
});

$this->client->getLoop()->addTimer($this->client->getHeartbeatInterval(), function(){
//Set a new timeout (1 sec seems reasonable)
$this->heartbeat_timer = $this->client->getLoop()->addTimer(2, function(){
$this->stream->close();
throw new ConnectionLostException();
});

$this->sendHeartbeat();

});
}

Expand Down

0 comments on commit 3aae0fd

Please sign in to comment.