Merge branch 'master' of git.code.tencent.com:jl-framework/graphic-pixi

This commit is contained in:
Yuan 2023-07-31 17:00:37 +08:00
commit 3a87487697

View File

@ -1,5 +1,5 @@
import { Centrifuge, State } from 'centrifuge';
import CentrifugeProtobuf from 'centrifuge/build/protobuf';
import { State } from 'centrifuge';
import Centrifuge from 'centrifuge/build/protobuf';
import { MessageCliOption } from './MessageBroker';
import {
ISubscription,
@ -19,7 +19,7 @@ export class CentrifugeMessagingClient extends MessageClient {
protocol: options.protocol,
});
} else {
this.cli = new CentrifugeProtobuf(options.wsUrl, {
this.cli = new Centrifuge(options.wsUrl, {
token: options.token,
protocol: options.protocol,
});
@ -55,7 +55,11 @@ export class CentrifugeMessagingClient extends MessageClient {
if (this.options.protocol === 'json') {
console.log('收到centrifuge消息:', ctx.data);
}
handle(ctx.data);
try {
handle(ctx.data);
} catch (error) {
console.log('websocket状态消息处理异常', error);
}
})
.on('subscribed', (ctx) => {
console.log('订阅centrifuge服务消息成功', destination, ctx);