Mows - MQTT.js over WebSockets
npm install mows --save
Tunnel MQTT through HTML5 websockets using node.js Streams, thanks to websocket-stream.
Mows is based on MQTT.js and it offers the same high-level API.
in the Browser
you can use browserify to package this module for browser use.
var mows = client = mows; // pass an optional 'ws://localhost:port' here. client;client; client;
See MQTT.js for the full API.
browserify steps
npm install -g browserify // install browserifycd node_modules/mowsnpm install // install dev dependenciesbrowserify browserjs -s mows > mowsjs // require mows.js in your client-side app
On Node
var mows = client = mows; client;client; client;
See MQTT.js for the full API.
Server API
It uses the ws
module to bake an
MQTT-enhaced websocket server:
var mows = ; var server = mows; server;
or it can be just used to attach it to an existent http server:
var http = mows = server = http; mows; server;
LICENSE - "MIT License"
Copyright (c) 2013 Matteo Collina (http://matteocollina.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.