[DFW.pm] CGI Web Socket

Stuart A Johnston saj at thecommune.net
Sat Apr 13 17:18:51 PDT 2013


A few notes:

I don't know why but the Standalone Plack backend does not work. Install 
Twiggy.  This should do it:

cpanm PocketIO Plack::App::File Plack::Builder Plack::Middleware::Static 
Plack::Handler::Twiggy

'plackup chat.psgi' starts up the server and will give you a local 
address like: http://0.0.0.0:5000/

This works but the chat.html file will be cached when you connect this 
way.  If you want to play around with the frontend use 
http://0.0.0.0:5000/chat.html and you won't have to restart the server 
every time you change the html.

Now I just need to find an excuse to use this at $work!



On 04/13/2013 06:20 PM, Stuart A Johnston wrote:
> PDXPM did a talk on this topic on Thursday.  What I gather is that you
> need a frontend library and a compatible backend.  Socket.IO and SockJS
> seem to be the most popular frontends.  Both have Perl modules for the
> backend, written by the same guy and based on Plack.
>
> PocketIO has a more interesting example and a longer history so I'm
> going to give that a try.
>
> https://metacpan.org/module/PocketIO
> https://metacpan.org/source/VTI/PocketIO-0.15/examples/chat
>
>
> On 04/13/2013 04:13 PM, Jerry Kassebaum wrote:
>> Could someone please give me  an HTML/JavaScript file and a Perl/CGI
>> file to get me started with web sockets?
>>
>> I'd suggest something like this. A Firefox tab and a Google Chrome tab
>> each are open to the same HTML/JavaScript site. The site has three
>> buttons. When I press any button in either browser it changes color PLUS
>> sends a message to my server which in turn sends a message through the
>> web socket so that the corresponding button in the other browser also
>> changes color.
>>
>> Thanks in advance! I'm willing to bribe with homebrew (mine) or homemade
>> wine (my wife's) if that will help.
>>
>> Jerry Kassebaum
>>
>>
>> _______________________________________________
>> Dfw-pm mailing list
>> Dfw-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/dfw-pm
>>
>
> _______________________________________________
> Dfw-pm mailing list
> Dfw-pm at pm.org
> http://mail.pm.org/mailman/listinfo/dfw-pm



More information about the Dfw-pm mailing list