Capgo MQTT __CAPGO_KEEP_0__ 저장소
이 플러그인 설치 단계와 전체 마크다운 가이드를 포함한 설치 명령어를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-mqtt`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/mqtt/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
설치
설치 섹션AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. 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-mqttbunx cap syncImport
Import 섹션import { MqttBridge } from '@capgo/capacitor-mqtt';API 개요
API 개요 섹션connect
연결 섹션현재 계약의 소스 정의를 참조하세요.
import { MqttBridge } from '@capgo/capacitor-mqtt';
const result = await MqttBridge.connect({ serverURI: 'https://example.com', port: 8080, clientId: 'client-id-123', username: 'username', password: 'password', setCleanSession: true, connectionTimeout: 1000, keepAliveInterval: 1000, setAutomaticReconnect: true,});console.log(result);disconnect
‘연결 해제’ 섹션현재 계약의 소스 정의를 참조하세요.
import { MqttBridge } from '@capgo/capacitor-mqtt';
const result = await MqttBridge.disconnect();console.log(result);subscribe
‘구독’ 섹션현재 계약의 소스 정의를 참조하세요.
import { MqttBridge } from '@capgo/capacitor-mqtt';
const result = await MqttBridge.subscribe({ topic: 'topic', qos: 1,});console.log(result);publish
‘게시’ 섹션현재 계약의 소스 정의를 참조하세요.
import { MqttBridge } from '@capgo/capacitor-mqtt';
const result = await MqttBridge.publish({ topic: 'topic', payload: 'payload', qos: 1, retained: true,});console.log(result);타입 참조
타입 참조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공개 API이 업스트림에서 변경될 때 다시 싱크를 실행하세요.
Getting Started에서 계속 진행하세요.
Section titled “Getting Started를 계속하기”Capgo를 사용 중이라면 시작하기 연동을 위해 대시보드와 API 운영을 계획하고 연결하세요. @capgo/capacitor-mqtt 사용 native 기능을 사용하는 @capgo/capacitor-mqtt에 대해 API 개요 API 개요 Introduction 소개에서 구현 세부 정보에 대해 설명합니다. API 키 for API 구현 세부 사항에 대해 장치 장치 구현 세부 사항