WebSocket
NAME
Lumberjack::Application::WebSocket - Lumberjack websocket provider
SYNOPSIS
use Lumberjack;
use Lumberjack::Dispatcher::Supply;
use Lumberjack::Application::WebSocket;
my $s = Lumberjack::Dispatcher::Supply.new;
Lumberjack.dispatchers.append: $s;
my &ws-app = Lumberjack::Application::WebSocket.new(supply => $s.Supply);
# You can of course use it anywhere a P6SGI app can be used:
HTTP::Server::Tiny.new(port => 8898).run(&ws-app);
DESCRIPTION
This class provides a P6SGI
application that implements a
WebSocket server endpoint that will emit the Lumberjack::Message
s
that are received on the Supply
provided to the constructor.
The messages are emitted as a JSON serialised form and it is the
responsibility of the receiving clients to parse and interpret
as appropriate. The structure that is used by the
Lumberjack::Dispatcher::Proxy
and is described (implemented
by,) Lumberjack::Message::JSON
.
It is the responsibility of the container application to locate the endpoint appropriately, itself it is agnostic to which path it is called at.
METHODS
method new
method new(Supply :$supply!)
The class only has a constructor, with one required parameter
supply
which must be a Supply which will provide the
Lumberjack::Messages that will be sent out by the websocket
connect. Typically this will be the Supply
of a
Lumberjack::Dispatcher::Supply
.