slashmili / phoenix-socket / Phoenix.Push

This module provides an interface for pushed messages


type alias Push msg =
{ event : String
, topic : String
, on : Dict String (Json.Decode.Value -> msg)
, payload : Json.Encode.Value 
}

Push model

init : String -> String -> Push msg

initializes Push with event name and the channel

initWithChannel : String -> Phoenix.Channel.Channel msg -> Push msg

initializes Push with event name and the channel

onError : (Json.Decode.Value -> msg) -> Push msg -> Push msg

When Channel replies with errro this message gets triggred

onErrorCommand : Json.Decode.Value -> Push msg -> Phoenix.Message.Msg msg

Convert a Error response to Message

onOk : (Json.Decode.Value -> msg) -> Push msg -> Push msg

When Channel replies with ok this message gets triggred

onOkCommand : Json.Decode.Value -> Push msg -> Phoenix.Message.Msg msg

Convert an Ok response to Message

withPayload : Json.Encode.Value -> Push msg -> Push msg

Adds payload to Push