Find your Openshift app ssh via
$ rhc appsand copy the Git url corresponding to the application of interest
Step 2:
You can then add that ssh value as a remote, named as openshift below
$ git remote add openshift -f "$SSH"
$ rhc appsand copy the Git url corresponding to the application of interest
$ git remote add openshift -f "$SSH"
var authenticate = function (client, username, password, callback) {
console.log('ping ', username);
// if (username == "test" && password.toString() == "test")
callback(null, true);
// else
// callback(null, false);
}
var authorizePublish = function (client, topic, payload, callback) {
callback(null, true);
}
var authorizeSubscribe = function (client, topic, callback) {
callback(null, true);
}
var mosca = require('mosca');
var ascoltatore = {
type: 'mongo',
url: 'mongodb://localhost:27017/mqtt',
pubsubCollection: 'ascoltatori',
mongo: {}
};
var moscaSetting = {
port: 1883,
host: "192.168.foo.bar", // specify an host to bind to a single interface
logger: {
level: 'debug'
},
persistence: {
factory: mosca.persistence.Mongo,
url: 'mongodb://localhost:27017/mqtt'
},
backend: ascoltatore
};
var http = require('http')
, dispatch = require('dispatch')
, broker = new mosca.Server(moscaSetting);
httpServ = http.createServer(
dispatch({
'/': function(req, res, next){
console.log('alpha romeo');
},
'/user/:id': function(req, res, next, id){
// ...
},
'/user/posts': function(req, res, next){
// ...
},
'/user/posts/(\\w+)': function(req, res, next, post){
// ...
}
})
);
broker.attachHttpServer(httpServ);
httpServ.listen(3000);
broker.on('ready', setup);
function setup() {
broker.authenticate = authenticate;
broker.authorizePublish = authorizePublish;
broker.authorizeSubscribe = authorizeSubscribe;
console.log('Mosca broker is up and running.');
}
broker.on("error", function (err) {
console.log(err);
});
broker.on('clientConnected', function (client) {
console.log('Client Connected \t:= ', client.id);
});
broker.on('published', function (packet, client) {
console.log("Published :=", packet);
});
broker.on('subscribed', function (topic, client) {
console.log("Subscribed :=", client.packet);
});
broker.on('unsubscribed', function (topic, client) {
console.log('unsubscribed := ', topic);
});
broker.on('clientDisconnecting', function (client) {
console.log('clientDisconnecting := ', client.id);
});
broker.on('clientDisconnected', function (client) {
console.log('Client Disconnected := ', client.id);
});
var express = require('express') // express 4
, app = express()
, port = 1117
, ipaddr = 'localhost';
app.get('/', function(req, res) {
res.sendFile(__dirname + '/public/index.html');
});
app.listen(port, ipaddr, function() {
console.log("Server up on " + ipaddr + ":" + port);
});
app.use("/components", express.static(__dirname + '/components'));
// configure API
var express = require('express') // express 4
, environment = require('./env.js')
, app = express()
, port = environment.PORT
, ipaddr = environment.IPDR;
app.use("/components", express.static(__dirname + '/components'));
app.get('/', function(req, res) {
res.sendFile(__dirname + '/public/index.html');
});
app.listen(port, ipaddr, function() {
console.log("Server up on " + ipaddr + ":" + port);
});
#!/bin/bash # install express 4 npm install --save express@4.x.x # add Polymer to project mkdir polymer_local; cd polymer_local git clone https://github.com/Polymer/tools.git ./tools/bin/pull-all.sh # move components dir mv components ../components # cleanup cd .. rm -rf polymer_local
// viewcontroller 1
vent.trigger('foo')
// viewcontroller2
foo: function() {
console.log('this.foobar', this.foobar)
}
// console
this.foobar unknown
this.vent = Backbone.Events('foo', function() {
this.foo();
});