<commit_before>var request = require('request');
var StreamFeed = require('./feed');
var signing = require('./signing');
var errors = require('./errors');
var crypto = require('crypto');
var utils = require('./utils');

var StreamClient = function() {
    this.initialize.apply(this, arguments);
};

StreamClient.prototype = {
    baseUrl: 'https://api.getstream.io/api/',

    initialize: function(apiKey, apiSecret, appId, options) {
        /*
         * initialize is not directly called by via stream.connect, ie:
         * stream.connect(apiKey, apiSecret)
         * secret is optional and only used in server side mode
         * stream.connect(apiKey, null, appId);
         */
        this.apiKey = apiKey;
        this.apiSecret = apiSecret;
        this.appId = appId;
        this.options = options || {};
        this.version = this.options.version || 'v1.0';
        this.fayeUrl = this.options.fayeUrl || 'https://getstream.io/faye';
        // track a source name for the api calls, ie get started or databrowser
        this.group = this.options.group || 'unspecified';
        // which data center to use
        this.location = this.options.location;
        if (this.location) {
        	this.baseUrl = 'https://' + this.location + '-api.getstream.io/api/';
        } else if (typeof(process) != "undefined" && process.env.LOCAL) {
            this.baseUrl = 'http://localhost:8000/api/';
        }
        this.handlers = {};
        this.browser = typeof(window) != 'undefined';
        this.node = !this.browser;

        if (this.browser && this.apiSecret) {
            throw new errors.FeedError('You are publicly sharing your private key. Dont use the private key while in the browser.');
        }
    },

    on: function(event, callback) {
        /*
         * Support for global event callbacks<commit_msg>use faye subdomain<commit_after>var request = require('request');
var StreamFeed = require('./feed');
var signing = require('./signing');
var errors = require('./errors');
var crypto = require('crypto');
var utils = require('./utils');

var StreamClient = function() {
    this.initialize.apply(this, arguments);
};

StreamClient.prototype = {
    baseUrl: 'https://api.getstream.io/api/',

    initialize: function(apiKey, apiSecret, appId, options) {
        /*
         * initialize is not directly called by via stream.connect, ie:
         * stream.connect(apiKey, apiSecret)
         * secret is optional and only used in server side mode
         * stream.connect(apiKey, null, appId);
         */
        this.apiKey = apiKey;
        this.apiSecret = apiSecret;
        this.appId = appId;
        this.options = options || {};
        this.version = this.options.version || 'v1.0';
        this.fayeUrl = this.options.fayeUrl || 'https://faye.getstream.io/faye';
        // track a source name for the api calls, ie get started or databrowser
        this.group = this.options.group || 'unspecified';
        // which data center to use
        this.location = this.options.location;
        if (this.location) {
        	this.baseUrl = 'https://' + this.location + '-api.getstream.io/api/';
        } else if (typeof(process) != "undefined" && process.env.LOCAL) {
            this.baseUrl = 'http://localhost:8000/api/';
        }
        this.handlers = {};
        this.browser = typeof(window) != 'undefined';
        this.node = !this.browser;

        if (this.browser && this.apiSecret) {
            throw new errors.FeedError('You are publicly sharing your private key. Dont use the private key while in the browser.');
        }
    },

    on: function(event, callback) {
        /*
         * Support for global event callbacks
{'fraction_non_alphanumeric': 0.13739837398373983, 'fraction_numerical': 0.0032520325203252032, 'mean_word_length': 2.4049815498154983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1602141', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1029, 'n_words': 281}