Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dcos/connection-manager

Package Overview
Dependencies
Maintainers
13
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dcos/connection-manager

This package allows to manage connections inside the browser and order them in a queue by priority.

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
13
Weekly downloads
 
Created
Source

Connection Manager Build Status

This package allows to manage connections inside the browser and order them in a queue by priority.

Browsers can open only a limited amount of connections so when you urgently need one there may not be a slot. This package solves the issue by providing a manager that enqueues all requested connections and priorities them accordingly.

Usage

import { XHRConnection, ConnectionEvent } from "@dcos/connections";
import ConnectionManager from "@dcos/connection-manager";

const connection = new XHRConnection("http://127.0.0.1");
connection.on(ConnectionEvent.CLOSE, function(event) {
  // doing something with event.target.response
});
ConnectionManager.enqueue(connection);

Connection will be opened by the manager once there's a slot available.

Connection types

At the moment connection-manager package exposes only one connection XHRConnection that wraps XmlHttpRequest

const connection = new XHRConnection("http://127.0.0.1", {
  method: "POST",
  body: "{}",
  contentType: "json"
});

Creating your own connection type

If you want to create your own connection type that will be compatible with the manager please extend AbstractConnection. Have a look at Connections/AbstractConnection.js for more info.

FAQs

Package last updated on 25 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc