Skip to content

Commit 56db31f

Browse files
committed
update to 0.5.5, support swow and add client open event for future use
1 parent f9027e3 commit 56db31f

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace OneBot\Driver\Event\WebSocket;
6+
7+
use OneBot\Driver\Event\DriverEvent;
8+
9+
class WebSocketClientOpenEvent extends DriverEvent
10+
{
11+
private int $fd;
12+
13+
private $send_callback;
14+
15+
public function __construct(int $fd, callable $send_callback)
16+
{
17+
$this->fd = $fd;
18+
$this->send_callback = $send_callback;
19+
}
20+
21+
public function getFd(): int
22+
{
23+
return $this->fd;
24+
}
25+
26+
public function send($data)
27+
{
28+
return call_user_func($this->send_callback, $this->fd, $data);
29+
}
30+
}

src/OneBot/Driver/Workerman/Worker.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class Worker extends \Workerman\Worker
4040
protected static $_availableEventLoops = [
4141
'event' => '\Workerman\Events\Event',
4242
'libevent' => '\Workerman\Events\Libevent',
43+
'swow' => '\Workerman\Events\Swow',
4344
'swoole' => '\Workerman\Events\Swoole',
4445
];
4546

src/OneBot/global_defines.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use ZM\Logger\ConsoleLogger;
1414

1515
const ONEBOT_VERSION = '12';
16-
const ONEBOT_LIBOB_VERSION = '0.5.3';
16+
const ONEBOT_LIBOB_VERSION = '0.5.5';
1717

1818
const ONEBOT_JSON = 1;
1919
const ONEBOT_MSGPACK = 2;

0 commit comments

Comments
 (0)