Official package · Frameworks

Realtime, waiting rooms and chat for Ktor

A Ktor 3 plugin in Kotlin: channel auth and webhook routes for pusher-js and Laravel Echo, a waiting room route plugin, and coroutine access to events, the Chat API and Approvals.

Maven Central versionLicense

Fastest way: one prompt with the Hibira plugin

Install the plugin in your AI coding agent and paste the prompt. The agent signs you in, creates a free app if you need one, writes the code and sends a test event. GitHub ↗

  1. Install the plugin

    claude plugin marketplace add hibira-io/agent-plugin
    claude plugin install hibira@hibira
  2. Paste this prompt

    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.

Prefer to do it by hand? These are the steps below:

  1. Install
  2. Set it up
  3. Use it

Other AI tools and what the plugin includes →

  • hibiraChannelAuth, hibiraUserAuth and hibiraWebhooks add the routes pusher-js and Laravel Echo need.
  • install(HibiraWaitingRoom) on a route sends visitors without a pass to the hosted waiting page.
  • Suspend functions for events, the Chat API and Approvals, and Live Chat verified visitors.

Sign in to see these snippets with your own cluster host. Sign in

  1. Install

    implementation("io.hibira:hibira-ktor:0.1.0")
  2. Set it up

    HIBIRA_APP_ID=YOUR_APP_ID
    HIBIRA_KEY=YOUR_APP_KEY
    HIBIRA_SECRET=YOUR_APP_SECRET
    HIBIRA_HOST=ws.hibira.io
  3. Use it

    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()}") }
            }
        }
    }

Before you start

  • The app secret is shown only once, when you create the app or rotate its secret. Keep it on your server, never in a browser or game build.
  • On the Free plan, list every origin your pages load from in the app’s allowed origins (http://localhost:3000 while developing, then your domain). "*" needs a paid plan.

Use the app key from your dashboard; the secret stays on your server. Channels, events and authorization endpoints work exactly as they do with Pusher. Create your free account →