diff --git a/src/Engine/SocketIO/Version1X.php b/src/Engine/SocketIO/Version1X.php index ea2d7ef..d65f73e 100644 --- a/src/Engine/SocketIO/Version1X.php +++ b/src/Engine/SocketIO/Version1X.php @@ -42,7 +42,9 @@ public function connect() return; } - $this->handshake(); + if($this->options['transport'] != 'websocket'){ + $this->handshake(); + } $protocol = 'http'; $errors = [null, null]; @@ -239,7 +241,7 @@ protected function handshake() */ protected function upgradeTransport() { - $query = ['sid' => $this->session->id, + $query = ['sid' => isset($this->session->id) ? $this->session->id : null, 'EIO' => $this->options['version'], 'transport' => static::TRANSPORT_WEBSOCKET]; @@ -308,8 +310,10 @@ protected function upgradeTransport() */ public function keepAlive() { - if ($this->session->needsHeartbeat()) { - $this->write(static::PING); + if($this->session){ + if ($this->session->needsHeartbeat()) { + $this->write(static::PING); + } } } }