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

@msbfe/report-websocket

v0.1.4

Published

## 安装 ``` yarn add @msbfe/report-websocket ```

Downloads

11

Readme

Report Websocket

安装

yarn add @msbfe/report-websocket

基本使用

import ReportWebSocket from '@msbfe/report-websocket'
const params = {
  courseId: '', // 课程ID
  channelId: '', // 渠道ID(RoomID)
  recordId: '', // 小节ID
  bzId: '',  // 用户Id
  saleTeacherId: '', // 销售老师
}
const websocket = await ReportWebSocket.initialize({
  ...params,
  env: "test", // 环境    
  wss: '', // 可选 如果传入了 wss 地址,默认会忽略 env 。 主要方便本地调试
  plateForm: ReportWebSocket.WatchSide.studySide, // 观看端(学员端|助教端)
})

// 监听链接是否正常打开
reportWebScoket.addEventListener('open', function () {
  console.log('open')
})
// 接受消息
reportWebScoket.addEventListener('message', function (event) {
  console.log('message')
})
// 监听连接关闭
reportWebScoket.addEventListener('close', function (event) {
  console.log('close')
})

静态属性

// 观看端
ReportWebSocket.WatchSide = {
  studySide: 1, // 观看端
  assistantSide: 2, // 助教端
};

// 终端类型
ReportWebSocket.TerminalType = {
  pc: 0,
  app: 1,
};

// 直播类型
ReportWebSocket.LiveType = {
  live: 0, // 直播
  playback: 1, // 回放
};

// 消息状态
ReportWebSocket.MessageStatus = {
  initStatus: 1, // 初始化连接
  closeStatus: 2, // 关闭连接
  normalStatus: 3, // 普通通信
  heartbeatStatus: 4, // 心跳状态
};

// 发送消息方式
ReportWebSocket.GeneralSmsEnum = {
  manualRefresh: 0, // 手动刷新
  record: 1, // 发言
  remark: 6, // 记录
};

静态方法

| 方法 | 描述 | | ----------- | ----------- | | onUserCountMessage | 用户列表 | | onAnnouncement | 公告 | | onPullBack | 黑明单 | | onUpdateLiveStreamStatus| 更新直播状态 | | onRemarkStatus | 监听备注更新状态 |

实例方法

reportRecord 记录发言

reportWebScoket.reportRecord()

refreshRecord 刷新发言

reportWebScoket.refreshRecord()

updateOptions 更新配置参数

reportWebScoket.updateOptions({
    bzId: ''
})

更新备注

reportWebScoket.setRemark({
  smsId: '', // UUID
  bzId: '', // 助教老师ID
  remarkDTO: {
    "userId": "", // 用户ID
    "nickName": "" // 用户昵称
  }
})

上报禁言状态

  reportWebScoket.reportBanChat({
    value: 0 // 0 取消禁言 1 禁言
  })

leave 关闭 websocket

reportWebScoket.leave()