Socket
Book a DemoInstallSign in
Socket

icet

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

icet

ICE (RFC 5245) implementation for TypeScript

0.0.4
latest
Source
npmnpm
Version published
Weekly downloads
11
450%
Maintainers
1
Weekly downloads
 
Created
Source

icet

ICE (RFC 5245) implementation for TypeScript

What is icet?

icet is a library for Interactive Connectivity Establishment (RFC 5245) in TypeScript .

Implemented with reference to aioice source code

Example

test("example", async () => {
  const a = new Connection(true, {
    stunServer: ["stun.l.google.com", 19302]
  });
  const b = new Connection(false, {
    stunServer: ["stun.l.google.com", 19302]
  });

  // # invite
  await a.gatherCandidates();
  b.remoteCandidates = a.localCandidates;
  b.remoteUsername = a.localUserName;
  b.remotePassword = a.localPassword;

  // # accept
  await b.gatherCandidates();
  a.remoteCandidates = b.localCandidates;
  a.remoteUsername = b.localUserName;
  a.remotePassword = b.localPassword;

  // # connect
  await Promise.all([a.connect(), b.connect()]);

  // # send data a -> b
  await a.send(Buffer.from("howdee"));
  let data = (await b.recv()).toString();
  expect(data).toBe("howdee");

  // # send data b -> a
  await b.send(Buffer.from("gotcha"));
  data = (await a.recv()).toString();
  expect(data).toBe("gotcha");

  await a.close();
  await b.close();
});

and see examples/cli

FAQs

Package last updated on 17 May 2020

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.