Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dalelane/mqlight-websockets-bridge
A WebSockets server that allows web apps to receive MQ Light messages.
https://github.com/dalelane/mqlight-websockets-bridge
Last synced: 24 days ago
JSON representation
A WebSockets server that allows web apps to receive MQ Light messages.
- Host: GitHub
- URL: https://github.com/dalelane/mqlight-websockets-bridge
- Owner: dalelane
- Created: 2015-05-25T21:05:15.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-05-25T21:18:10.000Z (over 9 years ago)
- Last Synced: 2024-05-16T01:03:58.222Z (6 months ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# mqlight-websockets-bridge
## Overview
A simplified example of how to build a proxy to allow web apps to subscribe to mqlight topics and get the message via WebSockets.![arch diagram](http://dalelane.co.uk/blog/post-images/150519-mqlight-with-websockets.jpg)
More background at http://dalelane.co.uk/blog/?p=3306
## Usage (client)
### Snippet to include in HTML
```var wsproxy = 'http://yourappname.mybluemix.net/';
// using wildcards is fine, but you should URL-encode it first
var topic = 'yourtopicname';var primus = new Primus(wsproxy + '?topic=' + topic);
primus.on('data', function onmsg(data) {
// this is your callback - when a message is published to mqlight
// your web app will get it here
});```
## Usage (server)
### Running locally
(Needs mqlight to be running locally)
```
npm install
npm start
```### Running in BlueMix
If you include this in an app deployed to Bluemix, it will connect to an MQ Light service bound to your app.