Re: [elm-discuss] Best [ractices for listening to EventSource (Server-Sent Events)

2016-09-16 Thread Erwan Queffélec
Thanks for your answers. I finally implemented SSE using ports. Works like
a charm and was actually quite trivial to code.

I would still love to see this implemented directly into an elm
package/core package, I'll follow Joaquin's advice and make the proposal to
elm-dev



On Wed, Sep 14, 2016 at 11:11 PM, Joaquín Oltra 
wrote:

>
> I'd recommend making the proposal with concrete use cases in elm-dev to be
> discussed, but then move on and use ports and get the job done with
> JavaScript.
>
> Native is mostly undocumented and apparently discouraged.
>
> Elm is (very) good for what it has been designed, but it's design process
> starts from specific use cases and it takes time.
>
> ---
>
> Personally I'd like to see some kind of promise/task port, since most of
> the times I send to JS I want to listen for a result/error coupled to that
> submission (like making a jsonp call), and promises/tasks ports would make
> that kind of interop feel a lot more natural in Elm.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Elm Discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/elm-discuss/ahvErQ1Mh-o/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.


Re: [elm-discuss] Best [ractices for listening to EventSource (Server-Sent Events)

2016-09-14 Thread Joaquín Oltra

I'd recommend making the proposal with concrete use cases in elm-dev to be 
discussed, but then move on and use ports and get the job done with JavaScript.

Native is mostly undocumented and apparently discouraged.

Elm is (very) good for what it has been designed, but it's design process 
starts from specific use cases and it takes time.

---

Personally I'd like to see some kind of promise/task port, since most of the 
times I send to JS I want to listen for a result/error coupled to that 
submission (like making a jsonp call), and promises/tasks ports would make that 
kind of interop feel a lot more natural in Elm.

-- 
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.


Re: [elm-discuss] Best [ractices for listening to EventSource (Server-Sent Events)

2016-09-14 Thread Sébastien Crème
>From a backend perspective, i would also argue that SSE are way more easier 
to *scale* than web sockets (due to working on HTTP (SSE) versus working on 
TCP(WS)).

On Wednesday, September 14, 2016 at 3:34:41 PM UTC+2, Erwan Queffélec wrote:
>
> >  one would have to come up with a very convincing argument (use-case) to 
> justify spending resources in the design and implementation of Elm's 
> EventSource API
>
> Tough one - especially since it's hard to not make that argument an 
> argument about SSE vs WebSockets, but I'll give it a shot
>
> Some context : I'm (we are) actually building a production application 
> with elm 0.17
>
> The simple argument would be : SSE is part of the HTML spec (
> https://html.spec.whatwg.org/multipage/comms.html#server-sent-events). 
> Why not follow the standard ?
>
> The complex argument would be that both technically and feature wise, SSE 
> and websockets do not really overlap each other - 
>
> - One could build an event-sourcing protocol over websockets, but it's 
> just one of their application. Web sockets are not 
> - While websockets are initiated by HTTP requests, it's a different 
> protocol. SSE is still HTTP. This has numerous implications form an 
> infra/devops perspective : for instance, SSE will go through firewall, 
> proxies, load-balancers as long as regular HTTP requests will.
>
> In short, having SSE in elm makes sense to me, because it can make sense 
> to use SSE over WebSockets (especially from a backend perspective)
>
> On Wednesday, September 14, 2016 at 2:08:11 PM UTC+2, Peter Damoc wrote:
>>
>> The only clean way is to use a port.
>>
>> The unclean but practical way to do this is to use Native (this is what 
>> you have in the git repository you linked) 
>>
>> To my knowledge, there is no built-in way of doing this in pure Elm and 
>> from how I understand the development of Elm, there are little chances for 
>> this to be on any roadmap. 
>> The functionality overlaps that of websockets (which is already available 
>> in Elm)  and one would have to come up with a very convincing argument 
>> (use-case) to justify spending resources in the design and implementation 
>> of Elm's EventSource API (Elm takes API design very seriously). 
>>
>>
>>
>>
>>
>>
>> On Wed, Sep 14, 2016 at 1:16 PM, Erwan Queffélec  
>> wrote:
>>
>>> Hi,
>>>
>>> I'm trying to find the cleanest possible way of subscribing and 
>>> receiving server side events (SSE) (
>>> http://www.html5rocks.com/en/tutorials/eventsource/basics/)
>>>
>>> So far I found this 
>>> https://stackoverflow.com/questions/35144530/how-to-capture-server-events-in-elm
>>>
>>> And this (code contributed by the SO answer author): 
>>> https://github.com/lukewestby/elm-http-event-source
>>>
>>> Is there any built-in way of doing this with elm yet ? Is that somewhere 
>>> on the roadmap ?
>>>
>>> Regards,
>>>
>>> Erwan
>>>
>>> -- 
>>> 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...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> There is NO FATE, we are the creators.
>> blog: http://damoc.ro/
>>
>

-- 
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.


Re: [elm-discuss] Best [ractices for listening to EventSource (Server-Sent Events)

2016-09-14 Thread Erwan Queffélec

>
>
> - One could build an event-sourcing protocol over websockets, but it's 
> just one of their application. Web sockets are not 
>
... Web sockets are not only designed to behave as event sources. 

-- 
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.


Re: [elm-discuss] Best [ractices for listening to EventSource (Server-Sent Events)

2016-09-14 Thread Erwan Queffélec
>  one would have to come up with a very convincing argument (use-case) to 
justify spending resources in the design and implementation of Elm's 
EventSource API

Tough one - especially since it's hard to not make that argument an 
argument about SSE vs WebSockets, but I'll give it a shot

Some context : I'm (we are) actually building a production application with 
elm 0.17

The simple argument would be : SSE is part of the HTML spec 
(https://html.spec.whatwg.org/multipage/comms.html#server-sent-events). Why 
not follow the standard ?

The complex argument would be that both technically and feature wise, SSE 
and websockets do not really overlap each other - 

- One could build an event-sourcing protocol over websockets, but it's just 
one of their application. Web sockets are not 
- While websockets are initiated by HTTP requests, it's a different 
protocol. SSE is still HTTP. This has numerous implications form an 
infra/devops perspective : for instance, SSE will go through firewall, 
proxies, load-balancers as long as regular HTTP requests will.

In short, having SSE in elm makes sense to me, because it can make sense to 
use SSE over WebSockets (especially from a backend perspective)

On Wednesday, September 14, 2016 at 2:08:11 PM UTC+2, Peter Damoc wrote:
>
> The only clean way is to use a port.
>
> The unclean but practical way to do this is to use Native (this is what 
> you have in the git repository you linked) 
>
> To my knowledge, there is no built-in way of doing this in pure Elm and 
> from how I understand the development of Elm, there are little chances for 
> this to be on any roadmap. 
> The functionality overlaps that of websockets (which is already available 
> in Elm)  and one would have to come up with a very convincing argument 
> (use-case) to justify spending resources in the design and implementation 
> of Elm's EventSource API (Elm takes API design very seriously). 
>
>
>
>
>
>
> On Wed, Sep 14, 2016 at 1:16 PM, Erwan Queffélec  > wrote:
>
>> Hi,
>>
>> I'm trying to find the cleanest possible way of subscribing and receiving 
>> server side events (SSE) (
>> http://www.html5rocks.com/en/tutorials/eventsource/basics/)
>>
>> So far I found this 
>> https://stackoverflow.com/questions/35144530/how-to-capture-server-events-in-elm
>>
>> And this (code contributed by the SO answer author): 
>> https://github.com/lukewestby/elm-http-event-source
>>
>> Is there any built-in way of doing this with elm yet ? Is that somewhere 
>> on the roadmap ?
>>
>> Regards,
>>
>> Erwan
>>
>> -- 
>> 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...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> There is NO FATE, we are the creators.
> blog: http://damoc.ro/
>

-- 
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.


Re: [elm-discuss] Best [ractices for listening to EventSource (Server-Sent Events)

2016-09-14 Thread Peter Damoc
The only clean way is to use a port.

The unclean but practical way to do this is to use Native (this is what you
have in the git repository you linked)

To my knowledge, there is no built-in way of doing this in pure Elm and
from how I understand the development of Elm, there are little chances for
this to be on any roadmap.
The functionality overlaps that of websockets (which is already available
in Elm)  and one would have to come up with a very convincing argument
(use-case) to justify spending resources in the design and implementation
of Elm's EventSource API (Elm takes API design very seriously).






On Wed, Sep 14, 2016 at 1:16 PM, Erwan Queffélec  wrote:

> Hi,
>
> I'm trying to find the cleanest possible way of subscribing and receiving
> server side events (SSE) (http://www.html5rocks.com/en/
> tutorials/eventsource/basics/)
>
> So far I found this https://stackoverflow.com/questions/35144530/how-to-
> capture-server-events-in-elm
>
> And this (code contributed by the SO answer author): https://github.com/
> lukewestby/elm-http-event-source
>
> Is there any built-in way of doing this with elm yet ? Is that somewhere
> on the roadmap ?
>
> Regards,
>
> Erwan
>
> --
> 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.
>



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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.