diff --git a/Protocols/Websocket.php b/Protocols/Websocket.php index bba8d2348..17869a820 100644 --- a/Protocols/Websocket.php +++ b/Protocols/Websocket.php @@ -226,9 +226,7 @@ public static function input($buffer, ConnectionInterface $connection) */ public static function encode($buffer, ConnectionInterface $connection) { - if (!is_scalar($buffer)) { - throw new \Exception("You can't send(" . \gettype($buffer) . ") to client, you need to convert it to a string. "); - } + $buffer = (string) $buffer; $len = \strlen($buffer); if (empty($connection->websocketType)) { $connection->websocketType = static::BINARY_TYPE_BLOB;