A nice place to start with if I want to go down the effect-module road.
Although as Mark said it rely on the WebSocket.LowLevel module, which
imply extra complexity in the implementation.

The resulting API looks a lot clearer and more natural than the other
phoenix implementation, which is a big bonus.

Le 17/05/2017 à 01:38, Oliver Searle-Barnes a écrit :
> You might find https://github.com/saschatimme/elm-phoenix useful to look
> at, it's an effects manager phoenix channels built on top of the
> websocket effects manager.
> 
> On Tuesday, 16 May 2017 15:30:18 UTC+1, Christophe de Vienne wrote:
> 
>     Hi everyone,
> 
>     I am attempting to implement the pub/sub NATS (https://nats.io)
>     protocol
>     on top of the WebSocket API as a TEA component.
> 
>     I have a hard time finding an API for subscriptions: for each
>     subscription some context must be kept, a unique subscription ID
>     generated and in some case a unique reply subject too, and I would like
>     each subscription to generate custom messages for the component which
>     made it.
> 
>     I suspect it would be a lot more natural with an effect module, with
>     which I could (hopefully) write, in any part of the application:
> 
>     subscriptions : Model -> Sub Msg
>     subscriptions model =
>         Nats.Subscribe model.endpoint "some.subject" MyMessage
> 
>     or, for req/rep (a pub + a short-living sub expecting a result):
> 
>     myrequest : Model -> Cmd Msg
>     myrequest model =
>         Nats.request model.endpoint "a.request.subject" MyReply
> 
> 
>     Another difficulty I have is that in some cases I need to send 2 or 3
>     messages through the websocket, in the right order, but WebSocket.send
>     returns a Cmd. So I have to concat the 3 commands in 1 message, which
>     works but oblige
> 
>     Am I wrong being tempted by using an effect module for this kind of
>     module ?
>     If so how can I mimick such an API with a TEA approach  ?
>     If not is there any documentation I can read to get familiar with
>     them ?
> 
>     Is there any existing module that does this kind of thing for another
>     protocol ?
> 
>     Thanks!
> 
>     -- 
>     Christophe de Vienne
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to elm-discuss+unsubscr...@googlegroups.com
> <mailto:elm-discuss+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

-- 
Christophe de Vienne

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to