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

turbo-easemob-node

v1.0.0

Published

环信IM/Push nodejs server

Downloads

7

Readme

环信推送nodeserver简易版SDK 暂未接入环信IM其他环节

根据环信开放平台放出的文档简单处理,原文档传送门


使用文档

yarn add turbo-easemob-node
import ease from 'turbo-easemob-node'

// 缓存实例,需拥有get,set方法
const cache = new Redis();
// 创建easemob实例
const easemob = new ease.easemob({
    appKey: '**********#demo',
    clientId: '********',
    clientSecret: '********',
    appName: 'demo',
    orgName: '******'
}, cache);

try {
    // 用户体系
    const user = new ease.User(easemob);
    // 注册用户【推送和IM通用】
    user.createUser('test', '123456');
    // 修改密码
    user.modifyPassword('test', '1234567');
    // 读取用户信息
    user.getUserInfo('test')
    // 读取用户在线状态
    user.getUserStatus(['test']);

    // 推送体系
    const push = new ease.Push(easemob);
    // 推送给用户信息
    push.sendToUsers(['test'], {
        title: '测试',
        content: "这是一个测试信息",
        easemob: {
            style: 0,
            iconUrl: ""
        },
    })

    // 推送给指定标签下的用户信息
    push.sendToUsersByLabel('man', {
        title: '测试',
        content: "这是一个测试信息",
        easemob: {
            style: 0,
            iconUrl: ""
        },
    })

    // 推送给所有人
    push.sendToAll({
        title: '测试',
        content: "这是一个测试信息",
        easemob: {
            style: 0,
            iconUrl: ""
        },
    })

    // Im,只支持文本、透传、自定义消息类型
    const im = new ease.ImMessage(easemob);
    // 设置接收人
    im.setReceiver("user1");
    // 增加接收人
    im.addReceiver("user2", "user3");
    // 发送文本消息
    im.sendTxtMessage("这是文本消息");
    // 发送透传消息
    im.sendCmdMessage("action1");
    // 发送自定义消息
    im.sendCustomMessage("envent1", {
        param1: 'val1'
    });
} catch (error) {
    console.error(error)
}