NAME
Plack::App::MQTTUI - Plack Application to provide simple UI for AJAX to MQTT bridge
VERSION
version 1.112330
SYNOPSIS
use Plack::App::MQTTUI;
my $app = Plack::App::MQTTUI->new(host => 'mqtt.example.com',
allow_publish => 1)->to_app;
# Or mount under /mqtt namespace, subscribe only
use Plack::Builder;
builder {
mount '/mqtt' => Plack::App::MQTTUI->new();
};
DESCRIPTION
This module is a Plack application that provides an AJAX to MQTT bridge. It can be used on its own or combined with Plack::Builder to provide an AJAX MQTT interface for existing Plack applications (such as Catalyst, Dancer, etc applications).
This distribution includes an example application eg/mqttui.psgi
that can be used for testing by running:
MQTT_SERVER=127.0.0.1 plackup eg/mqttui.psgi
then accessing, for example:
http://127.0.0.1:5000/?topic=test
http://127.0.0.1:5000/?topic=test&mxhr=1
The former provides a simple long poll interface (that will often miss messages - I plan to fix this) and the later provides a more reliable "multipart/mixed" interface using the DUI.Stream library.
METHODS
call($env)
This method responds to HTTP requests for '/'
, '/js/DUI.js'
and '/js/Stream.js'
and delegates handling of other requests to the "call($env)" in Plack::App::MQTT method.
API
This is an early release and the API is very likely to change in subsequent releases.
BUGS
This code has lots of bugs - multiple non-mxhr clients wont work, etc.
DISCLAIMER
This is not official IBM code. I work for IBM but I'm writing this in my spare time (with permission) for fun.
AUTHOR
Mark Hindess <soft-cpan@temporalanomaly.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Mark Hindess.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.