Fixed WebSocketClient::push TypeError, expects integer, but boolean given. (#940)

This commit is contained in:
李铭昕 2019-11-14 13:33:24 +08:00 committed by GitHub
parent 3fa03c5fbe
commit 2f7a8b0050
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -21,6 +21,7 @@
- [#909](https://github.com/hyperf/hyperf/pull/909) Fixed a issue that causes staled parallel execution.
- [#925](https://github.com/hyperf/hyperf/pull/925) Fixed the dead cycle caused by socket closed.
- [#932](https://github.com/hyperf/hyperf/pull/932) Fixed `Translator::setLocale` does not works in coroutine evnironment.
- [#940](https://github.com/hyperf/hyperf/pull/940) Fixed WebSocketClient::push TypeError, expects integer, but boolean given.
## Optimized

View File

@ -67,9 +67,15 @@ class Client
return $ret;
}
public function push(string $data, int $opcode = WEBSOCKET_OPCODE_TEXT, bool $finish = true): bool
/**
* @param bool|int $finish TODO: When swoole version >= 4.4.12, `finish` is SWOOLE_WEBSOCKET_FLAG_FIN or SWOOLE_WEBSOCKET_FLAG_COMPRESS
*/
public function push(string $data, int $opcode = WEBSOCKET_OPCODE_TEXT, $finish = null): bool
{
return $this->client->push($data, $opcode, $finish);
if (isset($finish)) {
return $this->client->push($data, $opcode, $finish);
}
return $this->client->push($data, $opcode);
}
public function close(): bool