แพ็กเกจอย่างเป็นทางการ · เฟรมเวิร์ก
เรียลไทม์ ห้องรอ และแชตสำหรับ Axum และ Actix Web
crate ของ Hibira ส่งเหตุการณ์ ลงนามการสมัครช่องและตรวจสอบ webhook วางห้องรอไว้หน้าเส้นทางของ Axum หรือ Actix Web และเรียก Chat API กับ Approvals
hibiracrates.io ↗GitHub ↗
วิธีที่เร็วที่สุด: ปลั๊กอิน Hibira กับพรอมต์เดียว
ติดตั้งปลั๊กอินในเอเจนต์เขียนโค้ด 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.
อยากทำเองใช่ไหม ขั้นตอนด้านล่างมีดังนี้:
- middleware ห้องรอสำหรับ Axum และ Actix Web โดย handler จะได้รับ pass ของผู้เยี่ยมชม
- การอนุญาตช่องส่วนตัวและ presence, การลงชื่อเข้าใช้ของ pusher-js และการตรวจสอบ webhook โดยไม่มีโค้ดเครือข่ายเมื่อปิด feature client
- Chat API, Approvals และผู้เยี่ยมชมที่ยืนยันตัวตนใน Live Chat จาก crate เดียวกัน
ลงชื่อเข้าใช้เพื่อดูโค้ดตัวอย่างเหล่านี้พร้อมโฮสต์คลัสเตอร์ของคุณเอง ลงชื่อเข้าใช้
ติดตั้ง
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));
ก่อนเริ่ม
- ซีเคร็ตของแอปจะแสดงเพียงครั้งเดียว ตอนสร้างแอปหรือตอนหมุนเวียนซีเคร็ต เก็บไว้บนเซิร์ฟเวอร์เท่านั้น ห้ามใส่ในเบราว์เซอร์หรือไฟล์บิลด์ของเกม
- แชนเนล private และ presence ต้องมี auth endpoint บนแบ็กเอนด์ที่ลงนามการสมัครรับด้วยซีเคร็ตของแอป เหมือนกับ pusher-js
ใช้ app key จากแดชบอร์ดของคุณ ส่วน secret ให้เก็บไว้บนเซิร์ฟเวอร์เท่านั้น ช่อง อีเวนต์ และ endpoint การยืนยันสิทธิ์ทำงานเหมือนกับที่ใช้กับ Pusher ทุกประการ สร้างบัญชีฟรีของคุณ →