공식 패키지 · 프레임워크
Ktor를 위한 실시간, 대기실, 채팅
Kotlin으로 작성된 Ktor 3 플러그인: pusher-js와 Laravel Echo에 필요한 채널 인증·웹훅 라우트, 대기실 라우트 플러그인, 그리고 코루틴으로 이벤트, Chat API, Approvals를 사용합니다.
io.hibira:hibira-ktorMaven Central ↗GitHub ↗
가장 빠른 방법: Hibira 플러그인과 프롬프트 하나
AI 코딩 에이전트에 플러그인을 설치하고 프롬프트를 붙여 넣으세요. 에이전트가 로그인하고, 필요하면 무료 앱을 만들고, 코드를 작성한 뒤 테스트 이벤트를 보냅니다. GitHub ↗
플러그인 설치
claude plugin marketplace add hibira-io/agent-plugin claude plugin install hibira@hibira이 프롬프트 붙여 넣기
Add Hibira Ktor (io.hibira:hibira-ktor) to this project. Follow https://hibira.io/guides/ktor, 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.
- hibiraChannelAuth, hibiraUserAuth, hibiraWebhooks가 pusher-js와 Laravel Echo에 필요한 라우트를 추가합니다.
- 라우트에서 install(HibiraWaitingRoom)을 하면 패스가 없는 방문자는 호스팅된 대기 페이지로 이동합니다.
- 이벤트, Chat API, Approvals용 suspend 함수와 Live Chat 인증 방문자.
로그인하면 예제 코드에 내 클러스터 호스트가 채워집니다. 로그인
설치
implementation("io.hibira:hibira-ktor:0.1.0")설정하기
HIBIRA_APP_ID=YOUR_APP_ID HIBIRA_KEY=YOUR_APP_KEY HIBIRA_SECRET=YOUR_APP_SECRET HIBIRA_HOST=ws.hibira.io사용하기
fun Application.module() { install(HibiraPlugin) routing { hibiraChannelAuth { channel -> val user = principal<UserIdPrincipal>() ?: return@hibiraChannelAuth deny() if (channel.startsWith("presence-")) presence(user.name) else allow() } route("/drop") { install(HibiraWaitingRoom) { room = "presale" } get { call.respondText("You are number ${call.waitingRoomPass!!.number()}") } } } }
시작하기 전에
- 앱 시크릿은 앱을 만들거나 시크릿을 교체할 때 한 번만 표시됩니다. 서버에만 두고, 브라우저나 게임 빌드에는 절대 넣지 마세요.
- Free 요금제에서는 페이지를 불러오는 모든 오리진을 앱의 허용 오리진에 등록하세요(개발 중에는 http://localhost:3000, 이후에는 내 도메인). "*"는 유료 요금제에서 쓸 수 있습니다.
대시보드의 앱 키를 사용하세요. 시크릿은 서버에만 둡니다. 채널, 이벤트, 인가 엔드포인트는 Pusher와 똑같이 동작합니다. 무료 계정 만들기 →