websocket的onMessage方法中是否有办法知道客户端发送的消息是text类型还是binary类型?
Open
- Dominant language
- PHP
- Stars
- 11.6k
- Forks
- 2.2k
- Avg merge
- 11h 30m
- Merged PRs (30d)
- 3
Description
```php
$worker->onMessage = function(TcpConnection $connection, $data)
{
//$data是text还是binary
}
```
js中的websocket接口可以根据data是string还是array buffer来判断,不过php中都是string。
有些场景下需要根据数据类型处理不同的业务逻辑,我看到`Workerman\Protocols\Websocket`里面是解析了opcode的,但似乎并没有暴露出来。
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.