NAME

jQluster::Server::WebSocket - jQluster server implementation using WebSocket transport

SYNOPSIS

In your app.psgi

use Plack::Builder;
use jQluster::Server::WebSocket;

my $jq_server = jQluster::Server::WebSocket->new();

builder {
    mount "/jqluster", $jq_server->to_app;
    mount "/", $your_app;
};

Then, in your JavaScript code

$.jqluster.init("my_node_id", "ws://myhost.mydomain/jqluster");

DESCRIPTION

jQluster::Server::WebSocket is part of jQluster project. To learn more about jQluster, visit https://github.com/debug-ito/jQluster.

This module is a jQluster server implementation using simple WebSocket transport. It accepts WebSocket connections and distribute jQluster messages through the connections.

jQluster::Server::WebSocket creates a PSGI application. You can use it as a stand-alone app or mount it together with your own app.

Currently jQluster::Server::WebSocket uses Plack::App::WebSocket, so your PSGI server must meet its requirements.

CLASS METHODS

$server = jQluster::Server::WebSocket->new(%args)

The constructor. Fields in %args are

logger => CODE (optional, default: do nothing)

A subroutine reference that the server calls when it wants to log something.

The $logger is called like

$logger->($level, $message)

where $level is a log level string such as "info", "warning", "error" etc. $message is the log message string.

OBJECT METHODS

$psgi_app = $server->to_app()

Create a PSGI application object from the $server.

SEE ALSO

jQluster::Server

jQluster server independent of connection implementations.

Plack::App::WebSocket

WebSocket server implementation as a Plack app.

REPOSITORY

https://github.com/debug-ito/jQluster-Server-WebSocket

BUGS AND FEATURE REQUESTS

Please report bugs and feature requests to my Github issues https://github.com/debug-ito/jQluster-Server-WebSocket/issues.

Although I prefer Github, non-Github users can use CPAN RT https://rt.cpan.org/Public/Dist/Display.html?Name=jQluster-Server-WebSocket. Please send email to bug-jQluster-Server-WebSocket at rt.cpan.org to report bugs if you do not have CPAN RT account.

AUTHOR

Toshio Ito, <toshioito at cpan.org>

LICENSE AND COPYRIGHT

Copyright 2013 Toshio Ito.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.