公式パッケージ · フレームワーク
Axum と Actix Web のためのリアルタイム・待合室・チャット
Hibira の crate は、イベント送信、チャンネル購読の署名と Webhook の検証、Axum や Actix Web のルートの前に置く待合室、Chat API と Approvals の呼び出しに対応します。
hibiracrates.io ↗GitHub ↗
最速の方法:Hibira プラグインとプロンプト 1 つ
AI コーディングエージェントにプラグインを入れて、プロンプトを貼り付けるだけ。エージェントがサインインし、必要なら無料アプリを作成し、コードを書いてテストイベントを送ります。 GitHub ↗
プラグインをインストール
claude plugin marketplace add hibira-io/agent-plugin claude plugin install hibira@hibiraこのプロンプトを貼り付け
Add Hibira Rust (hibira) to this project. Follow https://hibira.io/guides/rust, adapted to how this project is already set up. If I have no Hibira app yet, create a Free one that allows http://localhost so I can test right away. Keep the app key and secret in environment variables, add placeholders to .env.example, and never commit real values or send the secret to a browser. When you are done, send a test event, show me it arriving, and list the files you changed.
- Axum と Actix Web 向けの待合室ミドルウェア。ハンドラーは訪問者のパスを受け取ります。
- プライベート・プレゼンスチャンネルの認可、pusher-js のサインイン、Webhook の検証に対応し、client feature をオフにするとネットワークのコードを含みません。
- 同じ crate で Chat API、Approvals、Live Chat の認証済み訪問者も扱えます。
サインインすると、コード例にご自身のクラスターホストが入ります。 サインイン
インストール
cargo add hibira --features axum # or --features actix設定する
HIBIRA_APP_ID=YOUR_APP_ID HIBIRA_KEY=YOUR_APP_KEY HIBIRA_SECRET=YOUR_APP_SECRET HIBIRA_HOST=ws.hibira.io使う
use std::sync::Arc; use axum::{middleware, routing::get, Extension, Router}; use hibira::{waiting_room::axum_guard, Client, Config, Pass}; let config = Config::from_env()?; let hibira = Client::new(config.clone()); hibira.trigger(&["orders"], "order.shipped", &serde_json::json!({ "id": 1042 })).await?; let app = Router::new() .route("/drop", get(|Extension(pass): Extension<Pass>| async move { format!("You are number {}", pass.number) })) .layer(middleware::from_fn_with_state(Arc::new(config.waiting_room("presale")), axum_guard));
始める前に
- アプリのシークレットは、アプリの作成時とシークレットのローテーション時に一度だけ表示されます。サーバーにだけ置き、ブラウザやゲームのビルドには入れないでください。
- プライベートチャンネルとプレゼンスチャンネルには、pusher-js と同じく、アプリのシークレットで購読に署名する認可エンドポイントがバックエンドに必要です。
ダッシュボードのアプリキーを使ってください。シークレットはサーバー側だけに置きます。チャンネル、イベント、認可エンドポイントは Pusher とまったく同じように動作します。 無料でアカウントを作成 →