Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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.