__CAPGO_KEEP_2__

Getting Started

GitHub

Capgoの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-mqtt
bunx cap sync
import { MqttBridge } from '@capgo/capacitor-mqtt';

API Overview

API Overview

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();

現在の契約のソース定義を参照してください。

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

ソース定義を参照してください。

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

型リファレンス

「型リファレンス」

onConnectionLostListener

「onConnectionLostListener」
export type onConnectionLostListener = (x: { connectionStatus: string; reasonCode: number; message: string }) => void;

onConnectCompleteListener

「onConnectCompleteListener」
export type onConnectCompleteListener = (x: { reconnected: boolean; serverURI: string }) => void;

onMessageArrivedListener

「onMessageArrivedListener」
export type onMessageArrivedListener = (x: { topic: string; message: string }) => void;

真実の源

「真実の源」

このページはプラグインから生成されます。 src/definitions.ts.再度、上流で変更されたパブリックAPIのシンクを実行してください。

Getting Startedから続けてください。

Section titled “Getting Startedから続けてください”。

Capgoを使用している場合 Getting Started ダッシュボードとAPIの作業を計画するために、Capgoを使用している場合、Capgoを Using @capgo/capacitor-mqtt Using @capgo/capacitor-mqttのネイティブ機能のために API Overview API Overviewの実装詳細のために Introduction 実装の詳細については、Introductionを参照してください。 API キー 実装の詳細については、API キー、そして デバイス 実装の詳細については、デバイスを参照してください。