diff --git a/lib/app/JlGraphicApp.d.ts b/lib/app/JlGraphicApp.d.ts index 8f74514..2099f14 100644 --- a/lib/app/JlGraphicApp.d.ts +++ b/lib/app/JlGraphicApp.d.ts @@ -358,7 +358,7 @@ export interface IGraphicScene extends EventEmitter { /** * 发布websocket消息 */ - publishMessage(destination: string, message: string): void; + publishMessage(destination: string, message: Uint8Array): void; } declare abstract class GraphicSceneBase extends EventEmitter implements IGraphicScene { private graphicStore; @@ -496,7 +496,7 @@ declare abstract class GraphicSceneBase extends EventEmitter i /** * 发布websocket消息 */ - publishMessage(destination: string, message: string): void; + publishMessage(destination: string, message: Uint8Array): void; /** * 处理图形状态 * @param graphicStates diff --git a/lib/message/BasicMessageClient.d.ts b/lib/message/BasicMessageClient.d.ts index 290d813..f41639e 100644 --- a/lib/message/BasicMessageClient.d.ts +++ b/lib/message/BasicMessageClient.d.ts @@ -33,7 +33,7 @@ export declare abstract class MessageClient extends EventEmitter { * @param destination * @param message */ - publishMessage(destination: string, message: string): void; + publishMessage(destination: string, message: Uint8Array): void; /** * 是否已经连接 */ @@ -90,7 +90,7 @@ export declare class WsMsgCli { static registerSubscription(destination: string, handler: IMessageHandler): void; static unregisterSubscription(destination: string, handler: IMessageHandler): void; static registerAppMsgBroker(broker: AppWsMsgBroker): void; - static publishMessage(destination: string, message: string): void; + static publishMessage(destination: string, message: Uint8Array): void; static removeAppMsgBroker(broker: AppWsMsgBroker): void; static hasAppMsgBroker(): boolean; /** diff --git a/lib/message/MqttBroker.d.ts b/lib/message/MqttBroker.d.ts index 970271c..d726aba 100644 --- a/lib/message/MqttBroker.d.ts +++ b/lib/message/MqttBroker.d.ts @@ -10,5 +10,5 @@ export declare class MqttMsgClient extends MessageClient { unsubscribe0(destination: string): void; get connected(): boolean; close(): void; - publishMessage(destination: string, message: string): void; + publishMessage(destination: string, message: Uint8Array): void; } diff --git a/lib/message/WsMsgBroker.d.ts b/lib/message/WsMsgBroker.d.ts index ef94d47..770a4c0 100644 --- a/lib/message/WsMsgBroker.d.ts +++ b/lib/message/WsMsgBroker.d.ts @@ -7,6 +7,6 @@ export declare class StompMessagingClient extends MessageClient { get connected(): boolean; subscribe(destination: string, handle: HandleMessage): boolean; unsubscribe0(destination: string): void; - publishMessage(destination: string, message: string): void; + publishMessage(destination: string, message: Uint8Array): void; close(): void; } diff --git a/src/app/JlGraphicApp.ts b/src/app/JlGraphicApp.ts index ca017de..f746b59 100644 --- a/src/app/JlGraphicApp.ts +++ b/src/app/JlGraphicApp.ts @@ -615,7 +615,7 @@ export interface IGraphicScene extends EventEmitter { /** * 发布websocket消息 */ - publishMessage(destination: string, message: string): void; + publishMessage(destination: string, message: Uint8Array): void; } abstract class GraphicSceneBase @@ -1165,7 +1165,7 @@ abstract class GraphicSceneBase /** * 发布websocket消息 */ - publishMessage(destination: string, message: string) { + publishMessage(destination: string, message: Uint8Array) { this.checkWsMsgCli(); this.wsMsgBroker.publishMessage(destination, message); } diff --git a/src/message/BasicMessageClient.ts b/src/message/BasicMessageClient.ts index 5618d66..4aaf08c 100644 --- a/src/message/BasicMessageClient.ts +++ b/src/message/BasicMessageClient.ts @@ -70,7 +70,7 @@ export abstract class MessageClient this.getOrNewSubClient(destination).removeHandler(handle); } - publishMessage(destination: string, message: string): void { + publishMessage(destination: string, message: Uint8Array): void { const cli = this.getOrNewSubClient(destination); cli.publishMessage(destination, message); } @@ -130,7 +130,7 @@ export class SubscriptionClient { this.mc.unsubscribe(this.destination); } - publishMessage(destination: string, message: string): void { + publishMessage(destination: string, message: Uint8Array): void { if (this.mc.connected) { this.mc.publishMessage(destination, message); } diff --git a/src/message/MessageBroker.ts b/src/message/MessageBroker.ts index a060ca7..1f5a6ed 100644 --- a/src/message/MessageBroker.ts +++ b/src/message/MessageBroker.ts @@ -88,7 +88,7 @@ export interface IMessageClient extends EventEmitter { * @param destination * @param message */ - publishMessage(destination: string, message: string): void; + publishMessage(destination: string, message: Uint8Array): void; /** * 是否已经连接 */ @@ -168,7 +168,7 @@ export class WsMsgCli { WsMsgCli.appMsgBroker.push(broker); } - static publishMessage(destination: string, message: string) { + static publishMessage(destination: string, message: Uint8Array) { WsMsgCli.client.publishMessage(destination, message); } @@ -304,7 +304,7 @@ export class AppWsMsgBroker { }); } - publishMessage(destination: string, message: string) { + publishMessage(destination: string, message: Uint8Array) { WsMsgCli.publishMessage(destination, message); } diff --git a/src/message/MqttBroker.ts b/src/message/MqttBroker.ts index b876e54..dab5ada 100644 --- a/src/message/MqttBroker.ts +++ b/src/message/MqttBroker.ts @@ -112,10 +112,10 @@ export class MqttMsgClient extends MessageClient { console.warn('MQTT 消息客户端关闭失败', error); } } - publishMessage(destination: string, message: string): void { + publishMessage(destination: string, message: Uint8Array): void { console.debug('MQTT发布消息'); if(this.connected) { - this.cli.publish(destination, message); + this.cli.publish(destination, message as Buffer); }else { console.warn('MQTT 未连接,消息发布失败'); } diff --git a/src/message/WsMsgBroker.ts b/src/message/WsMsgBroker.ts index 1082f5a..76b7d0b 100644 --- a/src/message/WsMsgBroker.ts +++ b/src/message/WsMsgBroker.ts @@ -77,7 +77,7 @@ export class StompMessagingClient extends MessageClient { this.cli.unsubscribe(destination); } - publishMessage(destination: string, message: string): void { + publishMessage(destination: string, message: Uint8Array): void { console.debug('MQTT发布消息:未实现'); }