mqttBrokerService.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import Aedes from 'aedes';
  2. interface BrokerClient {
  3. id: string;
  4. username?: string;
  5. ip?: string;
  6. port?: number;
  7. connectedAt?: Date;
  8. }
  9. export declare class MqttBrokerService {
  10. private static instance;
  11. private broker;
  12. private server;
  13. private port;
  14. private connectedClients;
  15. private syncInterval;
  16. private constructor();
  17. static getInstance(): MqttBrokerService;
  18. start(): Promise<void>;
  19. stop(): Promise<void>;
  20. private setupBrokerEvents;
  21. private authenticateClient;
  22. private authorizePublish;
  23. private authorizeSubscribe;
  24. private isSuperuser;
  25. private checkAclPermission;
  26. private topicMatches;
  27. private getClientIp;
  28. private handleClientConnect;
  29. private handleClientDisconnect;
  30. private handleMessagePublish;
  31. private handleClientSubscribe;
  32. private handleClientUnsubscribe;
  33. private handleDeviceMessage;
  34. private handleOtaMessage;
  35. private handleRelayStateMessage;
  36. private handleRssiMessage;
  37. private handleWifiInfoMessage;
  38. private handleWifiStatusMessage;
  39. private handleSensorData;
  40. publishOtaCommand(taskId: number): Promise<void>;
  41. private executePendingOTATasks;
  42. private startDeviceStatusSync;
  43. getConnectedClients(): BrokerClient[];
  44. getConnectedClientCount(): number;
  45. getBroker(): InstanceType<typeof Aedes>;
  46. disconnectClient(clientId: string): boolean;
  47. publish(topic: string, payload: string | Buffer, options?: {
  48. qos?: number;
  49. retain?: boolean;
  50. }): Promise<void>;
  51. private detectPayloadFormat;
  52. private logAuth;
  53. private broadcastToWebSocket;
  54. }
  55. export {};
  56. //# sourceMappingURL=mqttBrokerService.d.ts.map