mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-03 20:27:59 +08:00
Merge pull request #170 from limingxinleo/websocket
Fixed some bug for websocket-server.
This commit is contained in:
commit
f591561a59
@ -20,6 +20,7 @@
|
||||
- [#148](https://github.com/hyperf-cloud/hyperf/pull/148) Fixed cannot generate the migration when migrates directory does not exist.
|
||||
- [#152](https://github.com/hyperf-cloud/hyperf/pull/152) Fixed db connection will not be closed when a low use frequency.
|
||||
- [#169](https://github.com/hyperf-cloud/hyperf/pull/169) Fixed array parse failed when handle http request.
|
||||
- [#170](https://github.com/hyperf-cloud/hyperf/pull/170) Fixed websocket server interrupt when request a not exist route.
|
||||
|
||||
# Removed
|
||||
|
||||
|
@ -15,6 +15,7 @@ namespace Hyperf\WebSocketServer\Exception\Handler;
|
||||
use Hyperf\Contract\StdoutLoggerInterface;
|
||||
use Hyperf\ExceptionHandler\ExceptionHandler;
|
||||
use Hyperf\ExceptionHandler\Formatter\FormatterInterface;
|
||||
use Hyperf\HttpMessage\Stream\SwooleStream;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Throwable;
|
||||
|
||||
|
@ -39,7 +39,7 @@ class Security
|
||||
];
|
||||
}
|
||||
|
||||
public function sign(string $key): string
|
||||
public function sign(string $key): string
|
||||
{
|
||||
return base64_encode(sha1(trim($key) . self::KEY, true));
|
||||
}
|
||||
|
@ -124,14 +124,16 @@ class Server implements MiddlewareInitializerInterface, OnHandShakeInterface, On
|
||||
|
||||
$class = $psr7Response->getAttribute('class');
|
||||
|
||||
FdCollector::set($request->fd, $class);
|
||||
if (! empty($class)) {
|
||||
FdCollector::set($request->fd, $class);
|
||||
|
||||
defer(function () use ($request, $class) {
|
||||
$instance = $this->container->get($class);
|
||||
if ($instance instanceof OnOpenInterface) {
|
||||
$instance->onOpen($this->server, $request);
|
||||
}
|
||||
});
|
||||
defer(function () use ($request, $class) {
|
||||
$instance = $this->container->get($class);
|
||||
if ($instance instanceof OnOpenInterface) {
|
||||
$instance->onOpen($this->server, $request);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (\Throwable $throwable) {
|
||||
// Delegate the exception to exception handler.
|
||||
$exceptionHandlerDispatcher = $this->container->get(ExceptionHandlerDispatcher::class);
|
||||
|
Loading…
Reference in New Issue
Block a user