# `Kotoba.Collab.Channel`
[🔗](https://github.com/hattoriai/kotoba/blob/v0.5.0/lib/kotoba/collab/channel.ex#L1)

A Phoenix Channel with authenticated, read-only-aware collaboration.

    defmodule MyAppWeb.CollabChannel do
      use Kotoba.Collab.Channel, supervisor: MyApp.CollabSupervisor

      def authorize(socket, document_id, action) do
        if MyApp.can_access?(socket.assigns.current_user, document_id, action),
          do: :ok, else: {:error, :forbidden}
      end
    end

`authorize/3` is required and runs on join and every transaction,
awareness message and flush. `action` is `:read` or `:write`. Role claims
also bound permissions: a read token cannot write. Configure the socket
transport's `max_frame_size` as well as this module's message limit.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
