feat: Introduce TinyMqttClient interface and implementation, update auth store for MQTT connection management

This commit is contained in:
2026-02-08 23:59:48 +07:00
parent 66028d934a
commit 85af2da6ad
6 changed files with 38 additions and 45 deletions

4
src/lib/interface.ts Normal file
View File

@@ -0,0 +1,4 @@
export interface ITinyMqttClient {
connect(): void;
disconnect(): void;
}

View File

@@ -1,5 +1,7 @@
import { ITinyMqttClient } from "./interface";
export type MessageCallback = (topic: string, payload: string) => void;
export class TinyMqttClient {
export class TinyMqttClient implements ITinyMqttClient {
private ws: WebSocket | null = null;
private encoder = new TextEncoder();
private decoder = new TextDecoder();