|
|
@@ -215,6 +215,9 @@ class Websocket implements \Workerman\Protocols\ProtocolInterface
|
|
|
*/
|
|
|
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. ");
|
|
|
+ }
|
|
|
$len = strlen($buffer);
|
|
|
if (empty($connection->websocketType)) {
|
|
|
$connection->websocketType = self::BINARY_TYPE_BLOB;
|