Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Lists all the events that happen in a meeting. Run with 'node events.js'.
// Uses the first meeting started after the application runs and will list all
// events, but only the first time they happen.
const redis = require("redis");
const config = require('config');
var target_meeting = null;
var events_printed = [];
var subscriber = redis.createClient(config.get(redis.port), config.get(redis.host));
subscriber.on("psubscribe", function(channel, count) {
console.log("subscribed to " + channel);
});
subscriber.on("pmessage", function(pattern, channel, message) {
try {
message = JSON.parse(message);
if (message.hasOwnProperty('envelope')) {
var message_name = message.envelope.name;
if (!containsOrAdd(events_printed, message_name)) {
console.log("\n###", message_name, "\n");
console.log(message);
console.log("\n");
var redis = require( 'redis' ),
qs = require( 'querystring' ),
config = require( '../config/redis' );
/******************************* redis client create ***************************************/
var client = redis.createClient( redis.port, redis.host );
/******************************* redis client create ***************************************/
client.on("error", function (err) {
console.log( 'redis error ' );
});
client.on( 'connect', function(){
console.log( 'redis connect ' );
});
/******************************* redis checked is connected before do something ***************************************/
function connect( cb ){
if( client.connected ){
cb();
} else {
client = redis.createClient( redis.port, redis.host );
function connect( cb ){
if( client.connected ){
cb();
} else {
client = redis.createClient( redis.port, redis.host );
client.on( 'connect', function( err, ret ){
cb();
})
}
}