__CAPGO_KEEP_0__

ページ/エリア: Capgo マーケティング ウェブサイト。役割: ウェブサイト コピー文。見られる場所: component doc/SignupCta.astro, component Hero.astro。メッセージ キー `hero_subtitle_v2` (Hero Subtitle V2)。

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 セットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。

ターミナル画面
bun add @capgo/capacitor-mqtt
bunx cap sync
import { MqttBridge } from '@capgo/capacitor-mqtt';

API まとめ

API Overview

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

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

import { MqttBridge } from '@capgo/capacitor-mqtt';
const result = await MqttBridge.subscribe({
topic: 'topic',
qos: 1,
});
console.log(result);

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

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 に対して、Sync を再実行してください。

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

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

あなたが使用している場合 Getting Started ダッシュボードと API の作業を計画するために使用している場合、 Using @capgo/capacitor-mqtt Using @capgo/capacitor-mqtt Using @API/__CAPGO_KEEP_1__-mqtt APIの実装詳細についての概要です。 Introduction MQTTプラグインの導入 API キー MQTTプラグインの導入の詳細については、API キーを参照してください。 デバイス MQTTプラグインの導入の詳細については、デバイスを参照してください。