Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This project wraps mqtt.js to run a bundled (browserify) version for the browser within a Web-Worker

License

NotificationsYou must be signed in to change notification settings

mqttjs/mqtt-worker

Repository files navigation

Travis Build

mqtt-worker

This project wraps mqtt.js to run a bundled (browserify) version for the browser within aWeb Worker. Currentlythis project is still prototypical and needs some work, feel free to help.

Usage

bower install --save mqttjs/mqtt-worker
<scriptsrc="bower_components/mqtt-wrapper/dist/MqttWorker.js"></script><script>varMqttWorker=require('MqttWorker');varmqtt=newMqttWorker("../mqttWorker.js",document.URL,true);// use the same API on mqtt available from https://github.com/mqttjs/MQTT.jsvarclient=mqtt.connect("ws://localhost:3005");client.setMaxListeners(11);client.on('connect',function(packet){console.log('MQTT.js is connected',packet);});client.subscribe('presence');client.publish('presence','Hello mqtt!');client.on('message',function(topic,message,packet){// message is Buffer casting to Stringconsole.log(String.fromCharCode.apply(null,message),packet);client.end();});client.on('close',function(){console.log('close');});</script>

Debug / Inspect

In Chrome Web Workers can be debuged at chrome://inspect/#workers.

Build

npm install
grunt

or

browserify -r ./lib/client.js:MqttWorker > dist/MqttWorker.jsbrowserify -r mqtt > dist/MqttBundle.js

Contributing

mqtt-worker is anOPEN Open Source Project. This means that:

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

See theCONTRIBUTING.md file for more details.

Contributors

mqtt-worker is only possible due to the excellent work of the following contributors:

Sandro KockGitHub/sandro-kTwitter/@_syn_k

License

MIT

About

This project wraps mqtt.js to run a bundled (browserify) version for the browser within a Web-Worker

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp