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

tq-message-center-engine

v2.0.0-alpha.6

Published

天阙消息中心引擎

Downloads

4

Readme

TQMessageCenterEngine 天阙消息中心引擎

  • 注意事项:
    • 2.0.0+版本是适配聚光推送

    • 1.4.x版本是无线云平台推送

Installing

npm install [email protected]
/********************初始化引擎********************/
var options = {
        appKey: 'com.tianque.tqvdc', // pd端 appkey,业务端需要保证唯一不要使用com.tianque.tqvdc,
        namespace:'com.tianque.message.user',//聚光后台配置获取
        accessKey: 'ofOjgtx7613ow7p4',//聚光后台配置获取
        accessSecret: 'tCzjJ0JJ3Ahsnf6GE7zCeDrTdj6aF71U',//聚光后台配置获取
        socketHost: 'http://192.168.110.187:10800', // socket 服务器 杭州测试环境
        apiHost: 'http://192.168.1.74:11300', // api 请求服务器 杭州测试环境
        clientId: 'userId',//业务端用户唯一id
    }

/********************导入引擎********************/
import TQMessageCenterEngine from 'tq-message-center-engine'

/********************初始化引擎********************/
var engine = new TQMessageCenterEngine(options)
/********************系统事件********************/
//当前用户上线
engine.on(TQMessageCenterEngine.EVENT_TYPES.CONNECT, function (data, ackServerCallback) {
    console.log(TQMessageCenterEngine.EVENT_TYPES.CONNECT, data)
})
//当前用户下线
engine.on(TQMessageCenterEngine.EVENT_TYPES.DISCONNECT, function (data, ackServerCallback) {
    console.log(TQMessageCenterEngine.EVENT_TYPES.DISCONNECT, data)
})
//其他用户下线
engine.on(TQMessageCenterEngine.EVENT_TYPES.USER_DISCONNECTED, function (data, ackServerCallback) {
    console.log(TQMessageCenterEngine.EVENT_TYPES.USER_DISCONNECTED, data)
})
//当前用户加入房间
engine.on(TQMessageCenterEngine.EVENT_TYPES.JOINED, function (data, ackServerCallback) {
    console.log(TQMessageCenterEngine.EVENT_TYPES.JOINED, data)
})
//当前用户离开房间
engine.on(TQMessageCenterEngine.EVENT_TYPES.LEAVED, function (data, ackServerCallback) {
    console.log(TQMessageCenterEngine.EVENT_TYPES.LEAVED, data)
})

/********************加入群组********************/
/**
 *
 * @param options
 * | **参数名称**              | **参数说明**   | **是否必须** | **数据类型**     | **schema** |
 * | ------------------------- | -------------- | ------------ | ---------------- | ---------- |
 * | room                      | 群名称         | true         | string           |            |
 * | roomType                  | 群类型         |              |                  |            |
 * | 值为:                    |                |              |                  |            |
 * | appSubset(应用内部群)     |                |              |                  |            |
 * | projectSubset(项目内部群) | true           | string       |                  |            |
 * @returns {AxiosPromise<any>}
 */
joinRoom(options);

//Examples
const options = {
  room: 'room1',
  roomType:'projectSubset'
}
engine.joinRoom(options).then((data) => {
  console.log('joinRoom', data)
})

/********************发送消息********************/
/**
 *
 * @param options
 *      | **参数名称**              | **参数说明**               | **是否必须** | **数据类型**       | 备注                           |
 *      | ------------------------- | -------------------------- | ------------ | ------------------ | ------------------------------ |
 *      | messageContent            | 消息内容                   | true         | string或object      | string:透传,object:转为json后传输|
 *      | messageTitle              | 消息标题                   | true         | string             |                                |
 *      | messageType               | 通知类型                   | true         | string             | 消息框架和视频通话使用了message,chat,leave,join类型,业务端消息类型需要避开上述类型|
 *      | offLine                   | 离线通知                   | false        | boolean            | 默认非离线                     |
 *      | msgId                     | 消息id                     | true         | string             |                                |
 *      | targetClientId            | 指定用户列表,逗号分割      | false        | string             |                                |
 *      | room                      | 群名称                     | false        | string             | targetClientId和room必有一个值 |
 *      | roomType                  | 群类型                     |              |                    |                                |
 *      | 值为:                    |                            |              |                    |                                |
 *      | appSubset(应用内部群)     |                            |              |                    |                                |
 *      | projectSubset(项目内部群) | false                      | string       | 当room不为空时必填 |                                |
 *      | roomAppKey                | 应用级群所属应用           | false        | string             | 当                             |
 *      | roomType=appSubset 时必传 |                            |              |                    |                                |
 *      | appKeySet                 | 需要发送到的应用APPkey集合 | false        | array              |                                |
 *      | clientTypeSet             | 需要发送到的客户端类型集合 | false        | array              |                                |
 * @returns {AxiosPromise<any>}
 */
sendMessage(options);
//示例
//群发 给room1所有人发送消息
const options = {
  room: 'room1',
  msgId:'1',
  messageType:'deommsg',
  roomType:'projectSubset',
  messageTitle:'title',
  messageContent:'hello',
}
engine.sendMessage(options).then(data => {
  console.log('sendMessage', data)
})
//给指定的人发送消息
const options = {
  targetClientId:[1,2],
  msgId:'1',
  messageType:'deommsg',
  roomType:'projectSubset',
  messageTitle:'title',
  messageContent:'hello',
}
engine.sendMessage(options).then(data => {
  console.log('sendMessage', data)
})
/********************离开群组********************/

/**
 *
 * @param options
 * | **参数名称**              | **参数说明**   | **是否必须** | **数据类型**     | **schema** |
 * | ------------------------- | -------------- | ------------ | ---------------- | ---------- |
 * | room                      | 群名称         | true         | string           |            |
 * | roomType                  | 群类型         |              |                  |            |
 * | 值为:                    |                |              |                  |            |
 * | appSubset(应用内部群)     |                |              |                  |            |
 * | projectSubset(项目内部群) | true           | string       |                  |            |
 * @returns {AxiosPromise<any>}
 */
leaveRoom(options)

//示例:
const options = {
  room: 'room1',
  roomType:'projectSubset'
}
engine.leaveRoom(options).then(data => {
  console.log('leaveRoom', data)
})

/********************退出连接********************/
engine.disconnect()