How to use the rhea.create_connection function in rhea

To help you get started, we’ve selected a few rhea 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 EnMasseProject / enmasse / agent / www / shared / address_service.js View on Github external
var self = this;  // 'this' is not available in the success function of $http.get
    this.user = null;
    this.closeEvent = null;
    this.outstanding_settles = {};
    this.error_queue = [];
    this.admin_disabled = true;
    this.address_index = {};
    this.connection_index = {};
    Object.defineProperty(this, 'addresses', { get: function () { return get_items_from_index(self.address_index); } });
    Object.defineProperty(this, 'connections', { get: function () { return get_items_from_index(self.connection_index); } });
    this.address_types = [];
    this.address_space_type = '';
    this._additional_listeners = [];
    var ws = rhea.websocket_connect(WebSocket);
    var connectionDetails = ws("wss://" + location.hostname + ":" + location.port + "/websocket", ["binary", "AMQPWSB10"]);
    this.connection = rhea.create_connection({"connection_details": connectionDetails, "reconnect":15000, rejectUnauthorized:true});
    this.connection.on('message', this.on_message.bind(this));
    this.connection.on('connection_open', function (context) {
        self.update_periodic_deltas_interval = setInterval(self.update_periodic_deltas.bind(self), 5000);
        self.update_depth_series_interval = setInterval(self.update_depth_series.bind(self), 30000);
        if (self.callback) {
            self.callback("peer_connected");
        }
    });
    this.connection.on('disconnected', function (context) {
        self.closeEvent = context.error;
        if (self.update_periodic_deltas_interval) {
            clearInterval(self.update_periodic_deltas_interval);
            self.update_periodic_deltas_interval = null;
        }
        if (self.update_depth_series_interval) {
            clearInterval(self.update_depth_series_interval);
github Azure / azure-event-hubs-node / client / lib / rhea-promise / connection.ts View on Github external
constructor(options?: rhea.ConnectionOptions) {
    this.options = options;
    this._connection = rhea.create_connection(options);
  }