Naboo's Podracing Misadventure

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

    0.4.0-beta.2 • 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();
    

    Keywords

    none

    Install

    npm i @rainway/web

    Homepage

    rainway.com

    DownloadsWeekly Downloads

    48

    Version

    0.4.0-beta.2

    License

    SEE LICENSE IN LICENSE

    Unpacked Size

    1.12 MB

    Total Files

    8

    Last publish

    Collaborators

    • bengreenier
    • andrewmd5
    • lynnrainway