npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

raylink-sdk

v1.0.8

Published

## Installation

Downloads

51

Readme

Raylink SDK for JavaScript

Installation

You can install Raylink-SDK using the npm package manager.

npm install raylink-sdk --save

Usage

import { Client } from 'raylink-sdk'

const url = 'wss://xxxxxxxxxxxxxxxxxxxxxxxx'

const config = {
  bitrate: 300,
  fps: 60,
  video_width: 1920,
  video_height: 1080,
}

// Instantiate
const client = new Client()
client.connect()

client.onConnect((connected) => {
  if (connected) {
    // Start streaming
    client
      .start({
        url,
        config,
      })
      .then((res) => {
        console.log(res)
      })
  } else {
    console.log('RayLink client disconnected!')
    setTimeout(() => {
      client.connect()
    }, 3000)
  }
})

// Stop streaming
client.stop()

start()

The start() method takes the following parameters:

  • iceServers: RTCIceServer[], representing a list of ICE servers.
  • config: Config, an optional object parameter used to configure the streaming media.

config parameters:

  • bitrate?: number, representing the bitrate (bps), optional.
  • fps?: number, representing the frame rate, optional.
  • video_width?: number, representing the video width, optional.
  • video_height?: number, representing the video height, optional.
  • color_mode?: '420' | '444', representing the color space, optional.

stop()

client.stop()

After calling stop(), the streaming will be stopped.

executeCommand(command: string) Method

The executeCommand method is used to send any arbitrary message to the client. This can be useful for sending additional data or commands to the client during a streaming session. The method takes a single parameter, command, which should be a JSON string.

const command = JSON.stringify({
  message: 'data',
  data: { key: 'value' },
})
client.executeCommand(command)

onResponse(callback: (response: Response) => void) Method

The onResponse method is used to listen for any arbitrary response from the client. This method takes a callback function as its only parameter. The callback function will be called whenever a response is received from the client that matches the criteria specified in the callback. The response object will contain a message property to identify the message type and a data property that contains the data received from the client.

client.onResponse((res) => {
  if (res.message === 'data') {
    console.log(res.data)
  }
})