Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
type: sequelize.DOUBLE,
allowNull: false
}
}, {
timestamps: false,
freezeTableName: true
});
// Initialize PubNub client
var pubnub = new pubnub({
ssl: true,
subscribe_key: 'sub-c-4377ab04-f100-11e3-bffd-02ee2ddab7fe'
});
// Subscribe (listen on) to channel
pubnub.subscribe({
channels: ['pubnub-market-orders']
});
// Handle message payload
pubnub.addListener({
message: function (message) {
console.log(message.message);
connection.sync({
//logging: ()=>{}
})
.then(function () {
// Build and Save message stream to database
var orderInstance = order.build({
order_time: message.message.timestamp,
trade_type: message.message.trade_type,
symbol: message.message.symbol,
init: function(repo) {
if (!config.isStandalone) {
return;
}
pubnub.subscribe({
channel: process.env.PUBNUB_CHANNEL || 'demo'
},
function(msg) {
repo.currentBranch(function(err, branch) {
if (err) {
console.error('Watch failed:', err);
return;
}
console.error('watch branch', branch, msg.ref, 'refs/heads/' + branch, msg.ref === 'refs/heads/' + branch);
if (msg.ref === 'refs/heads/' + branch) {
console.log('Updating branch', branch, 'updated to', msg.after);
admin.pull(repo, branch, function(err) {
if (err && !err.upToDate) {
return console.error(err);
}