Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Server-side Websocket implementations in non-event driven HTTP Server Environments

by unlinker (Monk)
on Jun 08, 2013 at 19:16 UTC ( #1037875=perlquestion: print w/ replies, xml ) Need Help??
unlinker has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to understand implementations/options for server-side Websocket endpoints - particularly in perl using PSGI/Plack and I have a question: Why are all server-side websocket implementations based around event-driven PSGI servers (Twiggy, Tatsumaki..etc.)?

I get that websocket communication is asynchronous, but a non-event driven PSGI server (say Starman) could spawn an asynchronous listener to handle the websocket side of things. I have seen (but not understood) PHP implementations of Websocket servers, so why cant the same be done with PSGI without having to change the server to an event driven one?

Comment on Server-side Websocket implementations in non-event driven HTTP Server Environments
Re: Server-side Websocket implementations in non-event driven HTTP Server Environments
by Corion (Pope) on Jun 08, 2013 at 19:27 UTC

    I think Mojolicious has a forking Websocket implementation in Mojo::Server::Daemon.

    Personally, I like in-process Websockets, as I use them to communicate between clients. Usually I don't have an elaborate message queue schema set up, so distributing information is done easiest by keeping all clients connected to the same process. This is where AnyEvent comes in very handy for me.

      Thanks for responding. Could you explain "in-process websockets" please? Do you mean: there is a single process (same pid) that handles communication with all the connected clients? The documentation for Mojo::Server::Daemon lists it as a non-blocking server and has an event loop. How is that different from Twiggy and other event driven HTTP servers?

        Yes, that's what I meant by "in-process websockets".

        And it seems I misread Mojo::Server::Daemon then - it seems no different from Twiggy.

Re: Server-side Websocket implementations in non-event driven HTTP Server Environments
by Anonymous Monk on Jun 08, 2013 at 22:57 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1037875]
Approved by davido
Front-paged by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2014-09-19 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (132 votes), past polls