slashmili / phoenix-socket / Phoenix.Socket

This module provides an interface for connecting to Phoenix Socket


type Socket msg

Socket model

init : String -> Socket msg

Initializes Socket using the websocket address

update : (Phoenix.Message.Msg msg -> msg) -> Phoenix.Message.Msg msg -> Socket msg -> ( Socket msg, Platform.Cmd.Cmd msg )

Handles Phoenix Msg

join : Phoenix.Channel.Channel msg -> Socket msg -> ( Socket msg, Platform.Cmd.Cmd (Phoenix.Message.Msg msg) )

Joins a channel Adds the channel to the socket model and returns a command that sends data

listen : (Phoenix.Message.Msg msg -> msg) -> Socket msg -> Platform.Sub.Sub msg

Listens to socket

push : Phoenix.Push.Push msg -> Socket msg -> ( Socket msg, Platform.Cmd.Cmd (Phoenix.Message.Msg msg) )

pushs a message

withLongPoll : Socket msg -> Socket msg

withLongPoll

subscribe : Phoenix.Channel.Channel msg -> Socket msg -> ( Socket msg, Platform.Cmd.Cmd (Phoenix.Message.Msg msg) )

Subscribes to a channel events Adds the channel to the socket model

endPoint : Socket msg -> String

pushedEvents : Socket msg -> Dict Basics.Int (Phoenix.Push.Push msg)

channels : Socket msg -> Dict String (Phoenix.Channel.Channel msg)

heartbeatTimestamp : Socket msg -> Time.Posix

withPayload : List ( String, String ) -> Socket msg -> Socket msg

withPayload