erlang to browsers ("sessions" question, I suppose)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

erlang to browsers ("sessions" question, I suppose)

Alexandre Karpov
Hi all,

I've just started on Cowboy (which I've discovered through this same mailing list, thanks y'all), and the introductory article resonated perfectly and expressed exactly the reasons for me quitting my last job to go on a "sabbatical" studying Erlang (which I've first found out back in 2010 from a talk by an Amazon's Principal Engineer in Seattle, who was leagues ahead of me in all things software, and was in love with the language and environment).

Aside from the goal of studying the language and OTP, there were a couple of questions which really interested me; hope they're not too hand-wavy and general to raise up:

1) Will there be a BEAM emulator in Javascript?
Joe chuckled in one of his talks how back when Erlang was being created, the computers it was to run on were weaker than our modern cell phones =) But, as I can see, the state of the art is still not quite there yet. What are your thoughts on it? Will this ever come? If no, why not? - and if yes, then what are the major problems? Because I'm sure you can see why this sounds like a majestic possible universe - imagine each browser a potential Erlang node...

2) Aside from that phantasy, having browser acting as a client of some Erlang system is obviously a reality long time ago. There are, well, web servers, and Cowboy with Websockets is an obvious point of interest. Sorry if I am using improper terminology here - is Cowboy server a good fit for creating and maintaining "sessions", which is to say, connections which have some sort of a pair of stateful process on the server side and a client side? Normally I'd think of databases when I think of such "persistent connections" - connection is actually stateless, but every request from a client is accompanied by database queries, and so we're faking the "session"... with WebSockets+Erlang, is there a more real session option? Is there already a setup where I get an Erlang process waiting for a next message from a browser, replying to the browser with a message?

Cheers,
Alex

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: erlang to browsers ("sessions" question, I suppose)

Mike French

(1)    I assume you want BEAM on Web Assembly these days, not JavaScript  …

 

http://webassembly.org/

 

Mike

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Alexandre Karpov
Sent: Sunday, October 08, 2017 5:54 AM
To: [hidden email]
Subject: [erlang-questions] erlang to browsers ("sessions" question, I suppose)

 

Hi all,

 

I've just started on Cowboy (which I've discovered through this same mailing list, thanks y'all), and the introductory article resonated perfectly and expressed exactly the reasons for me quitting my last job to go on a "sabbatical" studying Erlang (which I've first found out back in 2010 from a talk by an Amazon's Principal Engineer in Seattle, who was leagues ahead of me in all things software, and was in love with the language and environment).

 

Aside from the goal of studying the language and OTP, there were a couple of questions which really interested me; hope they're not too hand-wavy and general to raise up:

 

1) Will there be a BEAM emulator in Javascript?

Joe chuckled in one of his talks how back when Erlang was being created, the computers it was to run on were weaker than our modern cell phones =) But, as I can see, the state of the art is still not quite there yet. What are your thoughts on it? Will this ever come? If no, why not? - and if yes, then what are the major problems? Because I'm sure you can see why this sounds like a majestic possible universe - imagine each browser a potential Erlang node...

 

2) Aside from that phantasy, having browser acting as a client of some Erlang system is obviously a reality long time ago. There are, well, web servers, and Cowboy with Websockets is an obvious point of interest. Sorry if I am using improper terminology here - is Cowboy server a good fit for creating and maintaining "sessions", which is to say, connections which have some sort of a pair of stateful process on the server side and a client side? Normally I'd think of databases when I think of such "persistent connections" - connection is actually stateless, but every request from a client is accompanied by database queries, and so we're faking the "session"... with WebSockets+Erlang, is there a more real session option? Is there already a setup where I get an Erlang process waiting for a next message from a browser, replying to the browser with a message?

 

Cheers,

Alex


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: erlang to browsers ("sessions" question, I suppose)

Roman Galeev
> Is there already a setup where I get an Erlang process waiting for a next message from a browser, replying to the browser with a message?

Well, you don't need BEAM on a browser to have it. If you use web sockets, then Cowboy will spawn an Erlang process per each connection and manage its state. On a client, you need to have a singleton (or whatever) and do the same state management. Then you code a line protocol, and voila. And the web socket connection is persistent. This approach has an advantage: you can delegate the development of a browser UI to 'front-end' developers.

On Sun, Oct 8, 2017 at 8:57 AM, Mike French <[hidden email]> wrote:

(1)    I assume you want BEAM on Web Assembly these days, not JavaScript  …

 

http://webassembly.org/

 

Mike

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Alexandre Karpov
Sent: Sunday, October 08, 2017 5:54 AM
To: [hidden email]
Subject: [erlang-questions] erlang to browsers ("sessions" question, I suppose)

 

Hi all,

 

I've just started on Cowboy (which I've discovered through this same mailing list, thanks y'all), and the introductory article resonated perfectly and expressed exactly the reasons for me quitting my last job to go on a "sabbatical" studying Erlang (which I've first found out back in 2010 from a talk by an Amazon's Principal Engineer in Seattle, who was leagues ahead of me in all things software, and was in love with the language and environment).

 

Aside from the goal of studying the language and OTP, there were a couple of questions which really interested me; hope they're not too hand-wavy and general to raise up:

 

1) Will there be a BEAM emulator in Javascript?

Joe chuckled in one of his talks how back when Erlang was being created, the computers it was to run on were weaker than our modern cell phones =) But, as I can see, the state of the art is still not quite there yet. What are your thoughts on it? Will this ever come? If no, why not? - and if yes, then what are the major problems? Because I'm sure you can see why this sounds like a majestic possible universe - imagine each browser a potential Erlang node...

 

2) Aside from that phantasy, having browser acting as a client of some Erlang system is obviously a reality long time ago. There are, well, web servers, and Cowboy with Websockets is an obvious point of interest. Sorry if I am using improper terminology here - is Cowboy server a good fit for creating and maintaining "sessions", which is to say, connections which have some sort of a pair of stateful process on the server side and a client side? Normally I'd think of databases when I think of such "persistent connections" - connection is actually stateless, but every request from a client is accompanied by database queries, and so we're faking the "session"... with WebSockets+Erlang, is there a more real session option? Is there already a setup where I get an Erlang process waiting for a next message from a browser, replying to the browser with a message?

 

Cheers,

Alex


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions




--
With best regards,
     Roman Galeev,
     +420 702 817 968

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions