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

bmfe-base-chat

v1.0.3

Published

本木医疗前端基于websocket的聊天底层

Readme

支持性

目前支持 web 端和 app (weex)端的底层。

app

import ChatMixin from 'bmfe-base-chat/dist/js/mixin.js'
在中介者中 mixin 进来就可以使用

下载

sudo npm i bmfe-base-chat -S

使用

import { Chat } from 'bmfe-base-chat'
var chat = new Chat({ 
    url: '',                // socket 地址
    maxReconnectTime: '',   // 最大尝试重连次数
    heartbeatTime: '',      // 心跳发送间隔
    source: '',             // 业务标识
    debug: true,            // 是否开启debug模式 默认true
    platform: 'APP',        // 当前平台 WEB,APP 默认 APP
    errorCallback() {
        <!--重写 onerror 逻辑-->
    },
    closeCallback() {
        <!--重写 onclose 逻辑-->
    }
})
chat.subscribe('send.msg.success', msg => {
    <!--消息发送成功-->
})

chat.subscribe('get.msg.current.success', msg => {
    <!--收到了当前用户(to)的聊天消息-->
})

chat.subscribe('get.history.success', history => {
    <!--获取历史记录成功-->
})

chat.subscribe('get.list', list => {
    <!--list 发生变动的时候 chat 会自动外部推送-->
})

chat.subscribe('websocket.onopen', e => {
    <!--socket 已打开-->
})

chat.subscribe('websocket.onmessage', e => {
    <!--socket 收到服务器推送的消息-->
})

chat.subscribe('websocket.onerror', e => {
    <!--socket 报错-->
})

chat.subscribe('websocket.onclose', e => {
    <!--socket 关闭-->
})
<!--重连 默认已自动重连 断网的时候需自行调用-->
chat.reconnect()

<!--设置使用者id-->
chat.publish('set.from', from)

<!--设置接受者id-->
chat.publish('set.to', to)

<!--清空接受者id-->
chat.publish('clear.to')

<!--建立链接,注意需要设置完 from 和 to 时候才能建立连接-->
chat.publish('establish')

<!--发送消息-->
chat.publish('send.msg', data)

<!--data = {
    type: 'TEXT', // URL , IMAGE,
    content: '',
    <!-- 自定义额外参数-->
    ext: {    
        url: ''
    },
}-->

<!--获取当前历史记录-->
chat.publish('get.history', data)