Procházet zdrojové kódy

Update UdpConnection.php

mouyong před 3 roky
rodič
revize
3e72d1774a
1 změnil soubory, kde provedl 21 přidání a 3 odebrání
  1. 21 3
      src/Connection/UdpConnection.php

+ 21 - 3
src/Connection/UdpConnection.php

@@ -17,10 +17,8 @@ namespace Workerman\Connection;
 /**
  * UdpConnection.
  */
-class UdpConnection extends ConnectionInterface implements \JsonSerializable, \Serializable
+class UdpConnection extends ConnectionInterface implements \JsonSerializable
 {
-    use Traits\SerializeTrait;
-
     /**
      * Application layer protocol.
      * The format is like this Workerman\\Protocols\\Http.
@@ -208,4 +206,24 @@ class UdpConnection extends ConnectionInterface implements \JsonSerializable, \S
     {
         return $this->_socket;
     }
+    
+    /**
+     * Get the json_encode informattion.
+     *
+     * @return string
+     */
+    public function jsonSerialize()
+    {
+        return [
+            'transport' => $this->transport,
+            'getRemoteIp' => $this->getRemoteIp(),
+            'remotePort' => $this->getRemotePort(),
+            'getRemoteAddress' => $this->getRemoteAddress(),
+            'getLocalIp' => $this->getLocalIp(),
+            'getLocalPort' => $this->getLocalPort(),
+            'getLocalAddress' => $this->getLocalAddress(),
+            'isIpV4' => $this->isIpV4(),
+            'isIpV6' => $this->isIpV6(),
+        ];
+    }
 }