Cauldron2D.Net.Socket (Cauldron2D.Net v0.1.2)

Copy Markdown View Source

The player socket a game's browser players connect through, with the channel Cauldron2D.Net.Channel defines.

defmodule MyGame.Web.UserSocket do
  use Cauldron2D.Net.Socket, channel: MyGame.Web.WorldChannel, verify: {MyGame.Web.Auth, :verify}
end

:verify names a function given the connect params and answering {:ok, assigns} — a map with the player's :username and, when the game keeps them, :settings (:sfx and :music levels) — or :error. :topic is the channel's topic prefix (default "world"), :sheet_url where the sheet is served (default "/atlas.png").