Skip to content

Commit 1c23418

Browse files
authored
Merge pull request #27 from pvq212/main
fix: 修正了不能開箱即用的問題
2 parents 97835a9 + 952fafd commit 1c23418

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/Events/Subscribe.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function response(TcpConnection $connection, array $request): void
5151
$channel = $request['data']['channel'] ?? '';
5252
$channelData = $request['data']['channel_data'] ?? [];
5353
$clientAuth = $request['data']['auth'] ?? '';
54-
$appsCallback = PushServer::getConfig('apps_query', getBase: true);
54+
$appsCallback = PushServer::getConfig('app_verify', getBase: true);
5555

5656
// private- 和 presence- 开头的channel需要验证
5757
switch ($channelType = PushServer::getChannelType($channel)){
@@ -71,7 +71,7 @@ public function response(TcpConnection $connection, array $request): void
7171
} else {
7272
$auth = '';
7373
Log::channel('plugin.workbunny.webman-push-server.warning')
74-
->warning("[PUSH-SERVER] Subscribe auth error, Config apps_query not found. ", [
74+
->warning("[PUSH-SERVER] Subscribe auth error, Config app_verify not found. ", [
7575
'request' => $request,
7676
'method' => __METHOD__
7777
]);
@@ -102,7 +102,7 @@ public function response(TcpConnection $connection, array $request): void
102102
} else {
103103
$auth = '';
104104
Log::channel('plugin.workbunny.webman-push-server.warning')
105-
->warning("[PUSH-SERVER] Subscribe auth error, Config apps_query not found. ", [
105+
->warning("[PUSH-SERVER] Subscribe auth error, Config app_verify not found. ", [
106106
'request' => $request,
107107
'method' => __METHOD__
108108
]);

src/config/plugin/workbunny/webman-push-server/process.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// 推送服务器
1919
'push-server' => [
2020
'handler' => PushServer::class,
21-
'listen' => 'websocket://0.0.0.0:' . config('plugin.workbunny.webman-push-server.app.push-server.port', 8002),
21+
'listen' => 'websocket://0.0.0.0:' . config('plugin.workbunny.webman-push-server.app.push-server.port', 8001),
2222
'count' => cpu_count(),
2323
'reloadable' => false, // 执行reload不重启
2424
'reusePort' => true,

src/push.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Push.prototype.createConnection = function () {
6464
}
6565

6666
params = JSON.parse(params.data);
67+
6768
var event = params.event;
6869
var channel_name = params.channel;
6970

@@ -74,7 +75,7 @@ Push.prototype.createConnection = function () {
7475
if (event === 'pusher:error') {
7576
throw Error(params.data.message);
7677
}
77-
var data = JSON.parse(params.data), channel;
78+
7879
if (event === 'pusher_internal:subscription_succeeded') {
7980
channel = _this.channels[channel_name];
8081
channel.subscribed = true;
@@ -83,7 +84,7 @@ Push.prototype.createConnection = function () {
8384
return;
8485
}
8586
if (event === 'pusher:connection_established') {
86-
_this.connection.socket_id = data.socket_id;
87+
_this.connection.socket_id = params.data.socket_id;
8788
_this.connection.updateNetworkState('connected');
8889
_this.subscribeAll();
8990
}
@@ -93,7 +94,7 @@ Push.prototype.createConnection = function () {
9394
}
9495
channel = _this.channels[channel_name];
9596
if (channel) {
96-
channel.emit(event, data);
97+
channel.emit(event, params.data);
9798
}
9899
},
99100
onClose: function () {

0 commit comments

Comments
 (0)