내용으로 건너뛰기

Getting Started

GitHub

설치, 동기화 및 전체 소스 가이드를 한 번의 복사 가능한 명령어로 설정하세요.

설치, 동기화 및 전체 소스 가이드를 포함한 설치 단계와 마크다운 가이드를 복사할 수 있는 명령어를 복사하세요.

AI-Assisted 설치를 사용하여 플러그인을 설치할 수 있습니다. 다음 명령어를 사용하여 AI 도구에 Capgo 기능을 추가하세요:

터미널 창
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

다음과 같은 프롬프트를 사용하세요:

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-mqtt` plugin in my project.

만약 Manual Setup을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요:

터미널 창
bun add @capgo/capacitor-mqtt
bunx cap sync
import { MqttBridge } from '@capgo/capacitor-mqtt';

API 개요

API 개요

connect

연결

현재 계약의 소스 정의를 참조하세요.

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

해제

현재 계약의 소스 정의를 참조하세요.

import { MqttBridge } from '@capgo/capacitor-mqtt';
await MqttBridge.disconnect();

subscribe

구독

현재 계약의 소스 정의를 참조하세요.

import { MqttBridge } from '@capgo/capacitor-mqtt';
await MqttBridge.subscribe({} as { topic: string; qos: number });

publish

게시

현재 계약의 소스 정의를 참조하세요.

import { MqttBridge } from '@capgo/capacitor-mqtt';
await MqttBridge.publish({} as { topic: string; payload: string; qos: number; retained: boolean });

onConnectionLostListener

연결이 끊긴 리스너 섹션
export type onConnectionLostListener = (x: { connectionStatus: string; reasonCode: number; message: string }) => void;

onConnectCompleteListener

연결 완료 리스너 섹션
export type onConnectCompleteListener = (x: { reconnected: boolean; serverURI: string }) => void;

onMessageArrivedListener

메시지 도착 리스너 섹션
export type onMessageArrivedListener = (x: { topic: string; message: string }) => void;

진실의 근원

진실의 근원 섹션

이 페이지는 플러그인의 src/definitions.ts. upstream의 API이 변경될 때 다시 동기화 하세요.

Getting Started에서 계속

Getting Started에서 계속하는 섹션

Capacitor를 사용하는 경우 Getting Started 대시보드와 API 연산을 계획하려면 Capacitor를 사용하여 @capgo/capacitor-mqtt Capacitor를 사용하여 @capgo/capacitor-mqtt의 네이티브 기능 API 개요 API 개요의 구현 세부 정보 소개 소개의 구현 세부 정보 API 키 implementation 세부 정보에 대한 API 키 장치 implementation 세부 정보에 대한 장치