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

@veyetals/react-vitals-online

v1.0.14

Published

React component for web version of veyetals utilizing webrtc

Downloads

5

Readme

react-vitals-online

Made with create-react-library

NPM JavaScript Style Guide

Install

npm install @veyetals/react-vitals-online

Usage

username: username to authenticate user.

password: password to authenticate user.

channelName: Required* Create Channel to connect to for video and veyetals scanning. Maximum length: 128 characters. May include numbers, letters, underscores (_), and hyphens (-).

application: ie. 'veyetals'

platform: ie. 'ios'

environment: ie. 'prd' / 'stg'

userType: either 'master' or 'viewer.

mode: either 'video' or 'audio.

onCallEnd: Function to be called when user ends call.

onVitalsCompleted: Function to be called when veyetals is completed.

useWebSocket

isConnected: indicates connection to socket - true or false

connect: function to connect to socket *connection limit: 2 hrs

Arguments: userId

callUser: function to send info needed for a call

Arguments: userId, recipientId, channelName, mode

answerCall: function to notify caller of answer

Arguments: callerId, callerConnectionId, userId, answer

socketMessage: messages from socket

| function | user | description | socketMessage | | ---------- | --------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ | | callUser | caller | recipient is not in db | { status: 'callFailed', message: "recipientId not found" } | | callUser | caller | recipient is offline | { status: 'callFailed', message: "recipientId is offline" } | | callUser | recipient | recipient receives caller info | { status: 'callIncoming', callerId: 'callerId', callerConnectionId: 'callerConnectionId', channelName: 'channelName', mode: 'mode' } | | answerCall | recipient | caller is offline | { status: 'answerFailed', message: "recipientId is offline" } | | answerCall | caller | caller receives answer from callee | { status: "answerToCall", recipientId: 'recipientId', answer: true \ false } |

Example

import React, { useState } from 'react'

import { VitalsOnline, useWebSocket } from '@veyetals/react-vitals-online'

import '@veyetals/react-vitals-online/dist/index.css'

export default function App() {
  const {
    isConnected,
    socketMessage,
    connect,
    disconnect,
    callUser,
    answerCall
  } = useWebSocket()

  const [active, setActive] = useState(false)

  const [username, setUsername] = useState('')
  const [password, setPassword] = useState('')
  const [channelName, setChannelName] = useState('testChannel')
  const [userType, setUserType] = useState('master')
  const [mode, setMode] = useState('video')

  const [callerId, setCallerId] = useState('')
  const [recipientId, setRecipientId] = useState('')
  const [callerConnectionId, setCallerConnectionId] = useState('')
  const [callAnswer, setCallAnswer] = useState('')

  const startMaster = () => {
    setUserType('master')
    setActive(true)
  }

  const startViewer = () => {
    setUserType('viewer')
    setActive(true)
  }

  // Callback function to receive the final reading from the component
  const handleVitalsCompleted = (vitals) => {
    console.log(vitals)
  }

  // Callback function for message from mobile call
  const handleOnMobileCall = (resp) => {
    console.log('handleOnMobileCall: ', resp)
  }

  useEffect(() => {
    console.log('socketMessage: ', socketMessage)
  }, [socketMessage])

  return (
    <div>
      <span>isConnected: {isConnected.toString()}</span>
      <button onClick={() => connect(username)}>Connect</button>
      <label>
        recipientId:
        <input
          type='text'
          value={recipientId}
          onChange={(e) => setRecipientId(e.target.value)}
        />
      </label>
      <button
        onClick={() => callUser(username, recipientId, channelName, mode)}
      >
        Call
      </button>
      <label>
        callerId:
        <input
          type='text'
          value={callerId}
          onChange={(e) => setCallerId(e.target.value)}
        />
      </label>
      <label>
        callerConnectionId:
        <input
          type='text'
          value={callerConnectionId}
          onChange={(e) => setCallerConnectionId(e.target.value)}
        />
      </label>
      <label>
        callAnswer:
        <input
          type='text'
          value={callAnswer}
          onChange={(e) => setCallAnswer(e.target.value)}
        />
      </label>
      <button
        onClick={() =>
          answerCall(callerId, callerConnectionId, username, callAnswer)
        }
      >
        answerCall
      </button>
      <button onClick={startMaster}>startMaster</button>;
      <button onClick={startViewer}>startViewer</button>;
      {active && (
        <VitalsOnline
          username={username}
          password={password}
          channelName={channelName}
          application={application}
          platform={platform}
          environment={environment}
          userType={userType}
          mode={mode}
          onCallEnd={() => setActive(false)}
          onMobileCall={handleOnMobileCall}
          onVitalsCompleted={handleVitalsCompleted}
        />
      )}
    </div>
  )
}

License

MIT ©