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

@smarterservices/vps-proctor-socket-toolkit

v1.1.3

Published

toolkit of functions for smartersockets

Downloads

19

Readme

toolkit

A toolkit containing functions that help with standard smartersockets tasks

##Getting Started

npm install @smarterservices/vps-proctor-socket-toolkit

###Constructor:

var toolkit = require('@smarterservices/vps-proctor-socket-toolkit');
var kit = new toolkit({socket:socket}};

Note socket in config is where you pass your entire smarterservices socket

##Methods

###muteVideo

description: Used to publish to a listener telling the student that your video is muted.

Arguments

  • topic: topic of the listener
  • mute: Bool showing mute value.
    • true
    • false

Example

kit.muteVideo(topic,true);

###changeState

description: Used to publish to a listener telling them to change state.

Arguments

  • topic: topic of the listener
  • state: The state to change to.
    • exam-view
    • conversation-view

Example

kit.changeState(topic,state);

###examStatus

Invoked when you need to actually change the status of the exam.

Arguments

  • topic: topic of the listener
  • status: The status to change the exam to.
    • blocked
    • active

Example

kit.examStatus(topic,status);

When invoked will send paste: true with type pastText

Arguments

  • topic: topic of the listener

Example

kit.pasteText(topic);

When invoked will send boolean to pause or unpause student proctor session

Arguments

  • topic: topic of the listener
  • blockExam: boolean to pause exam or not.

Example

kit.blockExam(topic,blockExam);

Invoked to shift student applicaiton to fullscreen or not

Arguments

  • topic: topic of the listener
  • full: boolean to make fullscreen or no

Example

kit.fullScreen(topic,full);

description: Send video upload metadata over socket

Arguments

  • topic: topic of the listener
  • userId: the users id
  • sessionId: the session id for that video
  • videoType: the video type. I.e webcam,screen
  • videoTimestamp: the timestamp from the video
  • videoId: the video id
  • speed: the speed of the upload
  • size: the size of the upload
  • time: the time the upload took

Example

kit.s3Speed(topic,userId,sessionId,videoType,videoTimestamp,videoId,speed,size,time);

Events Emitted

socket.on('message',function(topic,res){})

description: generic listener for anything not expecting a res from .register method.

Example:

socket.on('message',function(topic,res) {
	console.log(topic,res	
}

socket.on('connect',function(){})

description: called when connected. If you need to do something after connected put inside this event. Is called again on reconnect so do NOT nest other listeners inside

Example:

socket.on('connect',function(){
	console.log('now connected');
};

description:If reconnect happens.

Example:

socket.on('reconnect',function(){
	console.log('now reconnected');
};

description: happens if error happens during connect or publish.

Example:

socket.on('error',function(error){
	console.log(error);
};

description: happens if state is switched to offline from online.

Example:

socket.on('disconnected',function(){
	console.log('now disconnected');
};

description: happens if reconnect fails(still offline).

Example:

socket.on('reconnectFailed',function(){
	console.log('now offline');
};

description: happens if socket connection is closed.

Example:

socket.on('close',function(){
	console.log('now closed socket');
};

###Disconnect Logic:

From there their client will try to reconnect every second(all socket events will be thrown into a queue).

Once reconnected will send reconnect message over all sessions they can publish to, empty their socket queue and emit a connect call from their socket.

socket.on('client.connected',function(obj){})

description: Happens if a new client connects to your topic

return: OBJECT {topic:topic,client:client_id}

Example:

socket.on('client.connected',function(res){
	console.log(res.topic,res.client);
};