AnyEvent-WebSocket-Client

 view release on metacpan or  search on metacpan

LICENSE  view on Meta::CPAN


                     END OF TERMS AND CONDITIONS

        Appendix: How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.

  To do so, attach the following notices to the program.  It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) 19yy  <name of author>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 1, or (at your option)
    any later version.

README  view on Meta::CPAN

    URI::ws, URI::wss, or a string that represents a legal WebSocket URL.

    You can override the connection host and port by passing them in as the
    second and third argument. These values (if provided) are passed
    directly into AnyEvent::Socket's tcp_connect function, so please note
    that function's idiosyncrasies in the AnyEvent::Socket documentation.
    In particular, you can pass in unix/ as the host and a filesystem path
    as the "port" to connect to a unix domain socket.

    This method will return an AnyEvent condition variable which you can
    attach a callback to. The value sent through the condition variable
    will be either an instance of AnyEvent::WebSocket::Connection or a
    croak message indicating a failure. The synopsis above shows how to
    catch such errors using eval.

FAQ

 My program exits before doing anything, what is up with that?

    See this FAQ from AnyEvent:
    AnyEvent::FAQ#My-program-exits-before-doing-anything-whats-going-on.

example/README  view on Meta::CPAN

   and a redis server running on localhost) that cordinates and
   displays job output.

 - jobrunner is an AnyEvent::WebSocket::Client program that runs a
   program locally and sends the output as events via WebSocket
   to jobserver.

 - slowlast is just a program that runs `last -30` very slowly so
   that you can see the output update on the server.

 - jobviewer is an AnyEvent::WebSocket::Client program that attaches
   to the jobserver and displays a job as it is running via
   WebSockets.

There are probably a few bugs and race conditions (in particular
events may be missing for currently running jobs in the webapp
or from the jobviewer) and there are probably better ways to do
this sort of thing, but it demonstrates the library so there it
is.

Instructions:

lib/AnyEvent/WebSocket/Client.pm  view on Meta::CPAN

L<URI::wss>, or a string that represents a legal WebSocket URL.

You can  override the connection host and port by passing them in as the
second and third argument.  These values (if provided) are passed directly
into L<AnyEvent::Socket>'s C<tcp_connect> function, so please note that
function's idiosyncrasies in the L<AnyEvent::Socket> documentation.  In
particular,  you can pass in C<unix/> as the host and a filesystem path
as the "port" to connect to a unix domain socket.

This method will return an L<AnyEvent> condition variable which you can
attach a callback to.  The value sent through the condition variable will
be either an instance of L<AnyEvent::WebSocket::Connection> or a croak
message indicating a failure.  The synopsis above shows how to catch
such errors using C<eval>.

=head1 FAQ

=head2 My program exits before doing anything, what is up with that?

See this FAQ from L<AnyEvent>:
L<AnyEvent::FAQ#My-program-exits-before-doing-anything-whats-going-on>.



( run in 0.827 second using v1.01-cache-2.11-cpan-e1769b4cff6 )