In our 0.4.0-beta.1 SDK release we’ve made improvements to our Web SDK focused on usability. We’re also announcing that as of today our developer tier (0-200K minutes) is completely free to use. We hope this makes it even easier to start experimenting with the Rainway SDK.

Developer tier is now free

In addition to improving our Web SDK, we’re making our developer tier free. Read more about this change in our blog post.

Web Ergonomics

We’ve made significant changes to the design of our Web SDK that aim to improve developer experience.

  • Event-based - We’ve moved away from global callbacks to per-object events.
  • Promisified - We now represent all async operations using Promise.
  • Composable - We’re commited to making @rainway/web a solid foundation to build on, with higher-level abstractions provided as additional packages.
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}`);

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

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

// add the stream container to the DOM, it will automatically 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();

For more information, see our updated documentation.