Channel Model
init : String -> Channel msg
Init channel model using channel topic
setJoiningState : Basics.Int -> Channel msg -> Channel msg
Sets the joining reference and state to Joining
setClosedState : Channel msg -> Channel msg
Sets stats to Closed
setJoinedState : Channel msg -> Channel msg
Sets stats to joined state
setErroredState : Channel msg -> Channel msg
Sets stats to Errored
isOngoing : Channel msg -> Basics.Bool
Returns true if state is Joined Joining
isClosed : Channel msg -> Basics.Bool
Is this channel closed ?
isJoined : Channel msg -> Basics.Bool
Is this channel joined successfully ?
isErrored : Channel msg -> Basics.Bool
Is this channel faild to join
addChannel : Channel msg -> Dict String (Channel msg) -> Dict String (Channel msg)
Adds a channel to Dict of channels
updateChannel : Channel msg -> Dict String (Channel msg) -> Dict String (Channel msg)
Updates channel in the given Dict
updateChannelDict : Channel msg -> Dict String (Channel msg) -> Dict String (Channel msg)
findChannelWithRef : String -> Maybe Basics.Int -> Dict String (Channel msg) -> Maybe (Channel msg)
Finds a channel with its topic and joinRef number
findChannel : String -> Dict String (Channel msg) -> Maybe (Channel msg)
Finds a channel in Dict of channels by its topic
on : String -> (Json.Decode.Value -> msg) -> Channel msg -> Channel msg
Triggers this message when event is received
onJoin : (Json.Decode.Value -> msg) -> Channel msg -> Channel msg
Triggers this message to send when joined a channel
onJoinError : (Json.Decode.Value -> msg) -> Channel msg -> Channel msg
Triggers this message to send when failed to join a channel
onError : (Json.Decode.Value -> msg) -> Channel msg -> Channel msg
Triggers this message when failed to send join command on the connection
onError messages are invoked if the channel crashes on the server.
onClose : (Json.Decode.Value -> msg) -> Channel msg -> Channel msg
Triggers this message when channel is closed
onClose messages are invoked if the channel explicitly closed on the server.
topic : Channel msg -> String
joinRef : Channel msg -> Maybe Basics.Int
receives : Channel msg -> Dict String (Json.Decode.Value -> msg)
ons : Channel msg -> Dict String (Json.Decode.Value -> msg)
payload : Channel msg -> Json.Encode.Value
withPayload : Json.Decode.Value -> Channel msg -> Channel msg
Includes payload during initializing the channel