@rainway/web
TypeScript icon, indicating that this package has built-in type declarations

0.5.0 • Public • Published

@rainway/web

The Rainway SDK Web Runtime. For more information check out docs.rainway.com.

Usage

import rainway, { InputLevel } from "@rainway/web";



// handle rainway component log events
rainway.addEventListener("log", (level, target, message) => {
    console.log(`[${level}] ${target} ${message}`);
});

// connect to Rainway services
const conn = await rainway.connect({apiKey: "YOUR_API_KEY" });

// obtain your id within the Rainway network
console.log(`Your peer id is ${conn.id}`);

// explicitly connect to another peer on the Rainway network using their id
const peer = await conn.connect(BigInt(12345678));

// attempt to create a stream between the peers, with permission to all input
const stream = await peer.createStream({ permissions: InputLevel.All });

// attach the stream to the element, it will automatically begin to play
document.appendChild(stream.container);

//
// additional application logic here
//

// shut down the stream
await stream.close();

// shut down the peer connection
await peer.close();

// shut down the rainway connection
await conn.close();

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.5.0
    2
    • latest

Version History

Package Sidebar

Install

npm i @rainway/web

Homepage

rainway.com

Weekly Downloads

2

Version

0.5.0

License

SEE LICENSE IN LICENSE

Unpacked Size

1.13 MB

Total Files

8

Last publish

Collaborators

  • bengreenier
  • andrewmd5
  • lynnrainway