eco-pro/elm-phoenix-ports/1.0.0

Rerouted (archive, verified). The original repository is gone. This copy comes from an archive (Software Heritage). The Lamdera package server serves a copy recovered from swh:1:rev:1944ed1c5ca26cf275cdf9c8775ec7beb06f860c (Software Heritage, origin https://github.com/eco-pro/elm-phoenix-ports).

What we checked: Software Heritage archived tag 1.0.0 of github.com/eco-pro/elm-phoenix-ports at commit 1944ed1c5ca2; its commit 1944ed1c5ca2 is from 2021-09-10 15:19 UTC, before the version was published (2021-09-10 15:22 UTC); elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip is our own, made from Software Heritage's copy of the files Elm uses, so its SHA-1 is not the published one.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/eco-pro/elm-phoenix-ports/zipball/1.0.0/

Phoenix.PortsAPI

Defines the API for the ports that are required to interface with JS.

This is just an internal implementation, but exposed so the types are available via the implementation of the ports in PhoenixPorts (which must be installed via NPM). See README.md for details.

External Ports API

This is the API that the ports module must implement.

type alias Ports msg =
{ channelMessage :
(( Topic, String, Value ) -> Msg msg) -> Sub (Msg msg)
, pushReply : (PushReply -> Msg msg) -> Sub (Msg msg)
, channelsCreated :
(List ( Topic, ChannelObj ) -> Msg msg) -> Sub (Msg msg)
, channelError : (Topic -> Msg msg) -> Sub (Msg msg)
, socketOpened : (() -> Msg msg) -> Sub (Msg msg)
, socketClosed : (SocketCloseParams -> Msg msg) -> Sub (Msg msg)
, presenceUpdated : (PresenceUpdate -> Msg msg) -> Sub (Msg msg)
, connectSocket : ConnectParams -> Cmd (Msg msg)
, joinChannels : List JoinParams -> Cmd (Msg msg)
, leaveChannel : ChannelObj -> Cmd (Msg msg)
, pushChannel : PushParams -> Cmd (Msg msg)
}

Functions that need to implemented by Ports

Internal types

These types are used internally to communicate between Elm and the JS ports code.

type alias ChannelMsg =
( Topic, Event, Value )

Message from a channel

type alias OnHandlers =
{ onOk : Bool
, onError : Bool
, onTimeout : Bool
}

Handlers to invoke on a push

type alias JoinParams =
{ topic : Topic
, payload : Value
, onHandlers : OnHandlers
, presence : Bool
}

Channel join params

type alias PushParams =
{ ref : Int
, channel : ChannelObj
, event : Event
, payload : Value
, onHandlers : OnHandlers
}

Push params

type alias PushReply =
{ eventName : String
, topic : Topic
, pushType : String
, ref : Maybe Int
, payload : Value
}

Push reply params

type alias ConnectParams =
{ endpoint : String
, params : Value
}

Socket connect params

type alias SocketCloseParams =
{ code : Int
, reason : String
, wasClean : Bool
}

Socket closed params

type alias PresenceUpdate =
{ eventName : String
, topic : Topic
, presences : List ( String, List Value )
}

Presence update reply params