クライアントライブラリ

HTML でリアルタイム WebSocket

どの Web ページにも script タグを 1 行追加するだけ。接続済みのクライアントに加え、リアルタイムのオンライン人数、フィード、トースト通知をビルドなしで使えます。

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

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

  1. script タグを追加

    <!-- Before </body>, on every page that needs live updates -->
    <script src="https://hibira.io/embed/v1.js" data-key="YOUR_APP_KEY" data-host="ws.hibira.io" async></script>
  2. 既製のウィジェットを配置

    <!-- People on this page right now (turn on "Send subscriber counts" in the app settings) -->
    <span data-hibira-online="lobby">0</span> online
    
    <!-- The newest "update" events on the news channel, newest first -->
    <ul data-hibira-feed="news" data-event="update" data-limit="10"></ul>
    
    <!-- A toast for each "alert" event: { "title": "...", "body": "...", "url": "..." } -->
    <div data-hibira-toast="alerts" data-event="alert" data-position="bottom-right"></div>
  3. 自分のコードでクライアントを使う

    // Runs as soon as the script has loaded, even if this code runs first.
    (window.Hibira = window.Hibira || []).push((client) => {
      client.subscribe('orders').bind('order-shipped', (data) => {
        console.log('Order shipped', data);
      });
    });

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

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

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

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

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