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 🙏

© 2026 – Pkg Stats / Ryan Hefner

monitor-ws-client

v1.0.0

Published

webSocket utils

Readme

监控webSocket SDK api

Installation

Install with npm:

npm install --save monitor-ws-client

###本SDK 遵守UMD规范,兼容CommonJs、CMD、AMD导入 Babel

import monitorWsClient from "monitor-ws-client";

CommonJs

 const monitorWsClient=require( "monitor-ws-client" );

Amd

define( [ "monitor-ws-client" ], function( monitorWsClient) {

} );

Browser

<script src="./monitor-ws-client.min.js"></script>
<script type="text/javascript">
        var webSocketObj = new monitorWsClient({ 'token': 'f062742310ab27eb6915a2a47e6a235cfaadd29f'});
         //建立连接(deptIds,多个部门之间逗号分隔),销毁之前连接
         //客户端主动关闭当前连接
         //webSocketObj.close();
         //建立连接监听
         webSocketObj.on('open', function(data) {
           console.log('WebSocket is open now.');
         });
         //连接关闭监听
         webSocketObj.on('close', function(data) {
           console.log('WebSocket is close now');
         });
         //初始化消息传输监听,用于初始化界面
         webSocketObj.on('init', function(data) {
           //获取数据处理逻辑,其中数据格式如下
           console.log('init Message from server ', data);
         });
         //消息传输监听,用于更新数据
         webSocketObj.on('message', function(data) {
           //获取数据处理逻辑,其中数据格式如下
           console.log('Message from server ', data);
         });

         //重连监听
         webSocketObj.on('reconnect', function(data) {
           console.log('WebSocket is reconnect ');
         });
         //连接异常监听
         webSocketObj.on('error', function(data) {
           console.log('WebSocket is error.');
         });
         webSocketObj.connect({ deptIds: 'id11,id22' });
    </script>

###推送数据格式如下

{
    "timeStamp": 1605593550,
    "code": 0,
    "message": "success",
    "data": {
        "agList": {
            "init": false,
            "data": [
                {
                    "agId": "313191",
                    "agName": "1773 刘隽廷",
                    "agReasonTime": 1605593550,
                    "agSta": 3,
                    "agStaReason": 0,
                    "agStaReasonStr": "置闲",
                    "agStaStr": "置闲",
                    "agStaTime": 1605593550,
                    "totalCallOutPostPTime": 228,
                    "totalStatusTimes_5": 228
                },
                {
                    "agId": "334855",
                    "agName": "2076 周春花",
                    "agReasonTime": 1605593549,
                    "agSta": 10,
                    "agStaReason": 0,
                    "agStaReasonStr": "外呼振铃",
                    "agStaStr": "外呼振铃",
                    "agStaTime": 1605593549,
                    "callMtype": 2,
                    "callQue": "",
                    "callQueName": "",
                    "callType": "2_1",
                    "callTypeDetail": 4121,
                    "incomingCallNum": "18858241394",
                    "preCallType": 2,
                    "totalCallOutEnterNum": 57,
                    "totalStatusNum_10": 62
                },
                {
                    "agId": "322585",
                    "agName": "1925 刘玉玉",
                    "callMtype": 2,
                    "callQue": "",
                    "callQueName": "",
                    "callType": "2_1",
                    "incomingCallNum": "13503468602",
                    "totalCallOutEnterNum": 91
                }
            ]
        }
    }
}

参考文档

####如您需要查看具体文档获取更多信息请点击以下链接 参考api文档