クライアントライブラリ

Flutter でリアルタイム WebSocket

iOS・Android・Web の Flutter / Dart アプリに対応。

サインインすると、コード例にご自身のクラスターホストが入ります。 サインイン

AI コーディングエージェントをお使いですか? エージェント用プロンプトをコピー ↓

  1. インストール

    flutter pub add dart_pusher_channels
  2. チャンネルを購読

    final options = PusherChannelsOptions.fromHost(
      scheme: 'wss',
      host: 'ws.hibira.io',
      port: 443,
      key: 'YOUR_APP_KEY',
    );
    final client = PusherChannelsClient.websocket(
      options: options,
      connectionErrorHandler: (error, trace, refresh) => refresh(),
    );
    
    final channel = client.publicChannel('orders');
    channel.bind('order-shipped').listen((event) => print(event.data));
    client.onConnectionEstablished.listen((_) => channel.subscribeIfNotUnsubscribed());
    await client.connect();

エージェント用プロンプト

Claude Code、Cursor、GitHub Copilot などの AI コーディングエージェントに貼り付けると、上記の設定で Hibira をご自身の Flutter プロジェクトに組み込みます。

YOUR_APP_KEY などのプレースホルダーはダッシュボードの値に置き換えてください。エージェントに環境変数として残させ、後から入力することもできます。

または Hibira MCP サーバーを接続すると、エージェントがアプリの作成と認証情報の設定まで自分で行います。 AI コーディングエージェントを接続 →

ダッシュボードのアプリキーとシークレットを使ってください。チャンネル、イベント、認可エンドポイントは Pusher とまったく同じように動作します。 ライブラリリファレンス ↗