Getting Started
이 콘텐츠는 아직 귀하의 언어로 제공되지 않습니다.
Install
Section titled “Install”bun add @capgo/capacitor-mqttbunx cap syncImport
Section titled “Import”import { MqttBridge } from '@capgo/capacitor-mqtt';API Overview
Section titled “API Overview”connect
Section titled “connect”See the source definitions for the current contract.
import { MqttBridge } from '@capgo/capacitor-mqtt';
await MqttBridge.connect({} as { serverURI: string; port: number; clientId: string; username: string; password: string; setCleanSession: boolean; connectionTimeout: number; keepAliveInterval: number; setAutomaticReconnect: boolean; setLastWill?: { willTopic: string; willPayload: string; willQoS: number; setRetained: boolean; }; });disconnect
Section titled “disconnect”See the source definitions for the current contract.
import { MqttBridge } from '@capgo/capacitor-mqtt';
await MqttBridge.disconnect();subscribe
Section titled “subscribe”See the source definitions for the current contract.
import { MqttBridge } from '@capgo/capacitor-mqtt';
await MqttBridge.subscribe({} as { topic: string; qos: number });publish
Section titled “publish”See the source definitions for the current contract.
import { MqttBridge } from '@capgo/capacitor-mqtt';
await MqttBridge.publish({} as { topic: string; payload: string; qos: number; retained: boolean });Type Reference
Section titled “Type Reference”onConnectionLostListener
Section titled “onConnectionLostListener”export type onConnectionLostListener = (x: { connectionStatus: string; reasonCode: number; message: string }) => void;onConnectCompleteListener
Section titled “onConnectCompleteListener”export type onConnectCompleteListener = (x: { reconnected: boolean; serverURI: string }) => void;onMessageArrivedListener
Section titled “onMessageArrivedListener”export type onMessageArrivedListener = (x: { topic: string; message: string }) => void;Source Of Truth
Section titled “Source Of Truth”This page is generated from the plugin’s src/definitions.ts. Re-run the sync when the public API changes upstream.