How to use the faye.Logging function in faye

To help you get started, we’ve selected a few faye examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fontello / fontello / lib / init / server / realtime.js View on Github external
module.exports.attach = function attach(server, next) {
  var faye = new Faye.NodeAdapter({ mount: '/faye' });

  if (process.env.FAYE_LOGLEVEL) {
    // This produces lots of logs, which are usefull
    // only during development of RT things.
    // USAGE: FAYE_LOGLEVEL=info ./fontello.js server
    Faye.Logging.logLevel = process.env.FAYE_LOGLEVEL;
  }

  // FIXME: Replace dummy active_clients inc/dec with real heartbeat/timeouts
  faye.bind('handshake',  function () { module.exports.activeClients++; });
  faye.bind('disconnect', function () { module.exports.activeClients--; });

  var curr_users_count = 0;
  setInterval(function () {
    if (module.exports.activeClients !== curr_users_count) {
      curr_users_count = module.exports.activeClients;
      faye.getClient().publish('/stats/users_online', curr_users_count);
    }
  }, 10000);

  faye.attach(server);
  next();
github nodeca / nodeca.core / lib / init / server / realtime.js View on Github external
module.exports.attach = function attach(server, next) {
  var faye = new Faye.NodeAdapter({ mount: '/faye' });

  if (process.env.FAYE_LOGLEVEL) {
    // This produces lots of logs, which are usefull
    // only during development of RT things.
    // USAGE: FAYE_LOGLEVEL=info ./fontello.js server
    Faye.Logging.logLevel = process.env.FAYE_LOGLEVEL;
  }

  faye.attach(server);
  next();
};
github mayflower / gigger / server / server.js View on Github external
/*
* Author: Felix Kaser 
* Copyright (c) 2011, Mayflower GmbH
* All rights reserved.
* 
* This software is distributed under the BSD 3-clause
* license. The full license can be found in ../LICENSE.
*/

var http = require("http"),
	faye = require("faye"),
	authenticator = require("./authenticator");

// log all warnings
faye.Logging.logLevel = 'warn';

// create new faye node
var bayeux = new faye.NodeAdapter({
		mount: "/faye",
		timeout: 45
	});
	
var serverAuth = {
	incoming: function(message, callback) {
		var closure = function(authenticated, cause) {
			var auth = message.ext && message.ext.auth;
			if (!authenticated) {
				cause = cause || 'no reason specified';
				faye.Logging.log(['message on ' + message.channel + ' not authenticated: ' + cause + " auth: " + auth], 'info');
				message.error = 'Not authenticated: ' + cause;
			} else {
github mayflower / gigger / server / server.js View on Github external
var closure = function(authenticated, cause) {
			var auth = message.ext && message.ext.auth;
			if (!authenticated) {
				cause = cause || 'no reason specified';
				faye.Logging.log(['message on ' + message.channel + ' not authenticated: ' + cause + " auth: " + auth], 'info');
				message.error = 'Not authenticated: ' + cause;
			} else {
				faye.Logging.log(['message on ' + message.channel + ' successfully authenticated: ' + auth], 'info');
			}
			callback(message);
		};

faye

Simple pub/sub messaging for the web

Apache-2.0
Latest version published 4 years ago

Package Health Score

76 / 100
Full package analysis