faustinoaq changed the topic of #amber to: Welcome to Amber Framework community! | https://amberframework.org | Developer happiness, productivity and bare metal performance | GH: https://github.com/amberframework | Docs: https://docs.amberframework.org | Gitter: https://gitter.im/amberframework/amber | IRC Logger: https://irclog.whitequark.org/amber | Amber::Server.start
feepbot has quit [Ping timeout: 268 seconds]
feepbot has joined #amber
<FromGitter> <anamba> started a book about elixir and phoenix over the weekend. ended up learning a lot about amber 😄 i came from rails, so i understood all the rails-inspired bits, but now i see where the rest comes from
<FromGitter> <mixflame> yeah. I never learned Elixir or Phoenix yet, but it was easy for me to grasp the concept of pipes, I don't know what else is taken from phoenix but amber is fine for me
<FromGitter> <Blacksmoke16> If you making a JSON API should check out Athena 😉
_whitelogger has joined #amber
_whitelogger has joined #amber
faustinoaq has joined #amber
faustinoaq has quit [Quit: IRC client terminated!]
<FromGitter> <42s_video_twitter> Hi ! Thx for Amber.
<FromGitter> <42s_video_twitter> 2 questions, first I am doing Server Side Event, I found a tutorial, so I can deliver it, but, not in the way I want. Indeed, as datais rendered, the connexion close and the EventSource in my browser try to reconnect. How can I deliver datas using a stream (is there a request.io that I can grab and stream on?)
<FromGitter> <42s_video_twitter> Second , in production, what would be better amber in standalone or do I have to put an NGINX in front of it.
<FromGitter> <42s_video_twitter> thx
<FromGitter> <mixflame> use websockets
<FromGitter> <mixflame> it can run in standalone or with nginx, it depends on what you need to do. if you need to host files, NGINX is better. but amber can run on it's own
<FromGitter> <42s_video_twitter> thx for websockets , it is just overkill for me ;)
<FromGitter> <mixflame> overkill is better than underkill
<FromGitter> <42s_video_twitter> ;)
<FromGitter> <mixflame> don't be afraid. I helped with the websockets stuff in Amber. it's very easy
<FromGitter> <42s_video_twitter> i am not, I have used WS once, it was just fine. It is just that I need to pratice SSE for a small project ...
<FromGitter> <mixflame> oh
<FromGitter> <mixflame> what is the intended effect? I don't believe SSE acts as a stream
<FromGitter> <42s_video_twitter> technicaly speaking SSE are using a plain HTTP request that just doesn't close , here from 2010 article : https://www.html5rocks.com/en/tutorials/eventsource/basics/
<FromGitter> <42s_video_twitter> php seems to do it with flush
<FromGitter> <mixflame> can you link the PHP code?
<FromGitter> <mixflame> i can take a look
<FromGitter> <42s_video_twitter> <?php ⏎ header('Content-Type: text/event-stream'); ⏎ header('Cache-Control: no-cache'); ⏎ ⏎ $time = date('r'); ... [https://gitter.im/amberframework/amber?at=5cbf9af5b489bb6ed7b39eb6]
<FromGitter> <42s_video_twitter> but that once will be more what i am looking for
<FromGitter> <42s_video_twitter> while(true) { ⏎ ⏎ $now = date('r'); ⏎ echo "data: The time is : {$now}\n\n"; ⏎ ... [https://gitter.im/amberframework/amber?at=5cbf9b30a4ef097471eafb13]
<FromGitter> <42s_video_twitter> the connection should not end
<FromGitter> <mixflame> i see
<FromGitter> <mixflame> can I see your amber code?
<FromGitter> <mixflame> or the relevant parts
<FromGitter> <42s_video_twitter> I have just this:
<FromGitter> <42s_video_twitter> response.headers["Content-Type"] = "text/event-stream"
<FromGitter> <42s_video_twitter> and this :
<FromGitter> <42s_video_twitter> "retry: 1000 ⏎ event: message ⏎ id: #{last_event_id} ⏎ data: #{remaining} ⏎ data: #{my_json} ... [https://gitter.im/amberframework/amber?at=5cbf9b962e2caa1aa6aa8bac]
<FromGitter> <42s_video_twitter> this is how rails deals with it
<FromGitter> <42s_video_twitter> def stream ⏎ ⏎ ```response.stream.close``` ⏎ ⏎ end [https://gitter.im/amberframework/amber?at=5cbf9bbce416b84519cc988f]
<FromGitter> <42s_video_twitter> it catches some "response.stream" object
<FromGitter> <mixflame> to be honest, I'm not 100% sure as it's never been discussed in here, atleast while I was watching, @elorest or @eliasjpr or @Blacksmoke16 might know... it could be that amber doesn't support it yet and we need to have it patched in
<FromGitter> <mixflame> for example, I dont see any mention of it on google
<FromGitter> <mixflame> to me, it seems clear that we don't implement this yet. Can you submit a patch?
<FromGitter> <Blacksmoke16> tbh i dont know anything about amber
<FromGitter> <Blacksmoke16> i never used it
<FromGitter> <mixflame> oh
<FromGitter> <mixflame> sry
<FromGitter> <42s_video_twitter> I planned to look more closely to amber code, it feels like I could try firstly in a pipe, but if it is too difficult I will propose a patch yes. Thx for the conversation. I might go to sleep for now (1 o'clock Paris time ;) I will tell you when I find a workaround
<FromGitter> <Blacksmoke16> im more of the granite/router guy
<FromGitter> <42s_video_twitter> good night boys
<FromGitter> <mixflame> sounds good @42s_video_twitter! Excited to hear how it turns out