walkor пре 2 година
родитељ
комит
f658690a00
3 измењених фајлова са 28 додато и 0 уклоњено
  1. 7 0
      src/Connection/AsyncTcpConnection.php
  2. 14 0
      src/Connection/TcpConnection.php
  3. 7 0
      src/Worker.php

+ 7 - 0
src/Connection/AsyncTcpConnection.php

@@ -33,6 +33,13 @@ class AsyncTcpConnection extends TcpConnection
     public $onConnect = null;
 
     /**
+     * Emitted when websocket handshake completed (Only work when protocol is ws).
+     *
+     * @var callable|null
+     */
+    public $onWebSocketConnect = null;
+
+    /**
      * Transport layer protocol.
      *
      * @var string

+ 14 - 0
src/Connection/TcpConnection.php

@@ -68,6 +68,20 @@ class TcpConnection extends ConnectionInterface implements \JsonSerializable
     const STATUS_CLOSED = 8;
 
     /**
+     * Emitted when socket connection is successfully established.
+     *
+     * @var callable|null
+     */
+    public $onConnect = null;
+
+    /**
+     * Emitted when websocket handshake completed (Only work when protocol is ws).
+     *
+     * @var callable|null
+     */
+    public $onWebSocketConnect = null;
+
+    /**
      * Emitted when data is received.
      *
      * @var callable

+ 7 - 0
src/Worker.php

@@ -150,6 +150,13 @@ class Worker
     public $onConnect = null;
 
     /**
+     * Emitted when websocket handshake completed (Only work when protocol is ws).
+     *
+     * @var callable|null
+     */
+    public $onWebSocketConnect = null;
+
+    /**
      * Emitted when data is received.
      *
      * @var callable