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

clientiotprotcol

v1.0.9

Published

use im to aws-oit

Downloads

5

Readme

clientiotprotcol

Use for AWS IOT JavaScript SDK

Install

npm install --save clientiotprotcol

Usage to HTTP API

Choton demo, the default POST request(调用demo,默认为POST请求)
var clientiot = require("clientiotprotcol");
var co = require('co');


//消息发送
 var data = {
    fromId: "111",
    fromType: "user",
    msgType: "text",
    targetId: "2222",
    targetType: "single",
    msgContent: {
        arn: "",
        durationTime: "",
        extras: "",
        fileSize: "",
        format: "",
        height: "",
        mediaCrc32: "",
        mediaId: "",
        text: "",
        width: ""
    }
}
 



co(function* () {
    /*消息发送(私有)*/
    console.log("===========消息发送(私有)=============");
    var retvalue = yield clientiot.messages.messagesPrivate(JSON.stringify(data));
    console.log(retvalue);

    /*获取指定消息记录(私有)*/
    console.log("===========获取指定消息记录(私有)=============");
    var retvalue = yield clientiot.messages.getMessagesPrivate("1111","2222","33333","44444");
    console.log(retvalue);

    /*获取最新一条树的消息(私有)*/
    console.log("===========获取最新一条树的消息(私有)=============");
    var retvalue = yield clientiot.messages.getMessagesPrivateLatest("1111", "2222");
    console.log(retvalue);

    /*获取最近指定条数的消息(私有)*/
    console.log("===========获取最近指定条数的消息(私有)=============");
    var retvalue = yield clientiot.messages.getMessagesPrivateRecently("1111", "2222",10);
    console.log(retvalue);

    /*获取未读条数(私有)*/
    console.log("===========获取未读条数(私有)=============");
    var retvalue = yield clientiot.messages.getMessagesPrivateUnRead("1111", "2222", 10);
    console.log(retvalue);

    /*获取指定消息的已读状态(私有)*/
    console.log("===========获取指定消息的已读状态(私有)=============");
    var retvalue = yield clientiot.messages.getMessagesPrivateMsgIdStatus("1111", "2222", "3333");
    console.log(retvalue);

    //消息发送(公有)
    console.log("===========消息发送(公有)=============");
    var retvalue = yield clientiot.messages.messagesPublic(JSON.stringify(data));
    console.log(retvalue);

    /*获取指定消息记录(公有)*/
    console.log("===========获取指定消息记录(公有)=============");
    var retvalue = yield clientiot.messages.getMessagesPublic("1111", "2222", "33333", "44444");
    console.log(retvalue);

    /*获取最新一条树的消息(公有)*/
    console.log("===========获取最新一条树的消息(公有)=============");
    var retvalue = yield clientiot.messages.getMessagesPublicLatest("1111", "2222");
    console.log(retvalue);

    /*获取最近指定条数的消息(公有)*/
    console.log("===========获取最近指定条数的消息(公有)=============");
    var retvalue = yield clientiot.messages.getMessagesPublicRecently("1111", "2222", 10);
    console.log(retvalue);

    /*获取未读条数(公有)*/
    console.log("===========获取未读条数(公有)=============");
    var retvalue = yield clientiot.messages.getMessagesPublicUnRead("1111", "2222", 10);
    console.log(retvalue);

    /*获取指定消息的已读状态(公有)*/
    console.log("===========获取指定消息的已读状态(公有)=============");
    var retvalue = yield clientiot.messages.getMessagesPublicMsgIdStatus("1111", "2222", "3333");
    console.log(retvalue);

    /*删除敏感词*/
    console.log("===========删除敏感词=============");
    var retvalue = yield clientiot.sensitiveWord.deleteSensitiveWord("你最帅");
    console.log(retvalue);

    /*查找敏感词*/
    console.log("===========查找敏感词=============");
    var retvalue = yield clientiot.sensitiveWord.getSensitiveWord("你最帅");
    console.log(retvalue);

    /*增加敏感词*/
    console.log("===========增加敏感词=============");
    var retvalue = yield clientiot.sensitiveWord.addSensitiveWord("你最帅");
    console.log(retvalue);

    /*修改敏感词*/
    console.log("===========修改敏感词=============");
    var retvalue = yield clientiot.sensitiveWord.updateSensitiveWord("你最帅","你超级帅");
    console.log(retvalue);

    /*获取所有员工*/
    console.log("===========获取所有员工=============");
    var retvalue = yield clientiot.employees.getEmployees();
    console.log(retvalue);

    /*通过部门ID获取员工列表*/
    console.log("===========通过部门ID获取员工列表=============");
    var retvalue = yield clientiot.employees.getEmployeesFindByDeptId("111111");
    console.log(retvalue);

    /*通过工牌号获得指定员工信息*/
    console.log("===========通过工牌号获得指定员工信息=============");
    var retvalue = yield clientiot.employees.getEmployeesEid("111111");
    console.log(retvalue);

    /*获取指定用户的所有群组*/
    console.log("===========获取指定用户的所有群组=============");
    var retvalue = yield clientiot.employees.getEmployeesEidGroups("111111");
    console.log(retvalue);

    /*指定用户是否屏蔽指定群的消息*/
    console.log("===========指定用户是否屏蔽指定群的消息=============");
    var retvalue = yield clientiot.employees.getEmployeesEidGroupsGroupShield("111111", "22222", true);
    console.log(retvalue);

    /*通过工牌号和截止日期获得指定员工消息列表*/
    console.log("===========通过工牌号和截止日期获得指定员工消息列表=============");
    var retvalue = yield clientiot.employees.getEmployeesEidMessageList("111111", "22222");
    console.log(retvalue);

    /*免打扰设置*/
    console.log("===========免打扰设置=============");
    var retvalue = yield clientiot.employees.getEmployeesEidNodistrub("111111", "single","3333333");
    console.log(retvalue);

    /*获取可用的群组列表*/
    console.log("===========获取可用的群组列表=============");
    var retvalue = yield clientiot.groups.getGroups();
    console.log(retvalue);

    /*获取可用的群组列表*/
    console.log("===========新增群组=============");
    var data = {
        "admit_mode": "1", //入群验证(0>需要管理员同意,1>不需要管理员同意,2>不允许加入) ,
        "group_name": "群组名称 ",
        "group_range": "群组范围",
        "group_theme": "群组主题",
        "group_type": "conference",//群组类别:organization>按组织架构 flight>按航班沟通 conference>按会议 project>按项目 lives>图文直播 custom>自定义 
        "invite_mode": "1", //邀请方式(0>群主邀请;1>群员可邀请) 
        "members": [
            0
        ],
        "owner_eid": 0//群主的工牌号
    }
    var retvalue = yield clientiot.groups.addGroups(data);
    console.log(retvalue);


    /*按群组类型获取群组列表*/
    console.log("===========按群组类型获取群组列表=============");
    var retvalue = yield clientiot.groups.getGroupsByType("1111111");
    console.log(retvalue);

    /*获取指定员工加入的所有群组*/
    console.log("===========获取指定员工加入的所有群组=============");
    var retvalue = yield clientiot.groups.getGroupsByEid("1111111");
    console.log(retvalue);

    /*删除群组*/
    console.log("===========删除群组=============");
    var retvalue = yield clientiot.groups.deleteGroups("1111111");
    console.log(retvalue);

    /*获取群组信息*/
    console.log("===========获取群组信息=============");
    var retvalue = yield clientiot.groups.getGroups("1111111");
    console.log(retvalue);

    /*修改群组信息*/
    console.log("===========修改群组信息=============");
    var data = {
        "description": "群组描述",
        "inviteMode": 0,//邀请方式(0>群主邀请;1>群员可邀请)
        "admit_mode": 1,//入群验证(0>需要管理员同意,1>不需要管理员同意,2>不允许加入)
        "managerCount": 1,//管理员数量
        "proclamation": "群公告"
    }
    var retvalue = yield clientiot.groups.updateGroups("1111111", data);
    console.log(retvalue);

    /*获取指定群组的所有成员*/
    console.log("===========获取指定群组的所有成员=============");
    var retvalue = yield clientiot.groups.getGroupsGidMembers("1111111");
    console.log(retvalue);

    /*更新群组成员*/
    console.log("===========更新群组成员=============");
    var retvalue = yield clientiot.groups.updateGroupsGidMembers("1111111","2222222222");
    console.log(retvalue);

    /*移交群主*/
    console.log("===========移交群主=============");
    var retvalue = yield clientiot.groups.groupsGidOwner("1111111", "2222222222","333333");
    console.log(retvalue);

});




/*控制台程序自动关闭限制*/
setInterval(() => console.log('Long wait'), 10000);

####统一返回json数据demo(Unit returns to the JSON data demo)

{"errorMessage":"","errorCode":"","success":true,"data":{}}

####示例

{
	"errorMessage": "",
	"errorCode": "",
	"success": true,
	"data": {
		"curtime": "1532582226",
		"issmarter": "1",
		"xmusicnum": "4",
		"picurl": [],
		"playlist": [{
			"xqusic_mid": "002NkERn2LNVI4 ",
			"xqusic_id": "105030812",
			"xctype": "3",
			"xexpire_time": "0",
			"xdesc": " ",
			"xsong_name": "Faded ",
			"xsinger_name": "Alan Walker ",
			"xsong_url": "http://stream8.qqmusic.qq.com/117030812.wma ",
			"xsong_size": "1834194",
			"xsong_playtime": "212",
			"xsong_diskname": "Faded ",
			"xsong_dissmid": ["002Nt51E0q8Zoo ", "002Nt51E0q8Zoo "],
			"xsong_dissid": "1211728",
			"xis_word": "0",
			"xcopy_right": "0",
			"xsinger_id": "944940",
			"xsinger_mid": "0020PeOh4ZaCw1 "
		}, {
			"xqusic_mid": "000aB5HG4dioBi ",
			"xqusic_id": "4831024",
			"xctype": "3",
			"xexpire_time": "0",
			"xdesc": " ",
			"xsong_name": "海誓山盟亦会分开 ",
			"xsinger_name": "本兮 ",
			"xsong_url": "http://stream6.qqmusic.qq.com/16831024.wma ",
			"xsong_size": "2496570",
			"xsong_playtime": "289",
			"xsong_diskname": "无底线 ",
			"xsong_dissmid": ["004LrhoF44bRf2 ", "004LrhoF44bRf2 "],
			"xsong_dissid": "193826",
			"xis_word": "0",
			"xcopy_right": "0",
			"xsinger_id": "4545",
			"xsinger_mid": "003LaMHm42u7qS "
		}, {
			"xqusic_mid": "0019kz9c1QBWNA ",
			"xqusic_id": "2633764432",
			"xctype": "1",
			"xexpire_time": "0",
			"xdesc": " ",
			"xsinger_name": "文艺范电台 ",
			"xsong_name": "文艺范电台 ",
			"xsong_url": "http://img.wenyifan.net/20131221/5/1387627094890.mp3 ",
			"xsong_size": "0",
			"xsong_playtime": "0",
			"xsong_diskname": "0",
			"xsong_dissmid": "0047airw212ppN ",
			"xsong_dissid": "0",
			"xis_word": "-999",
			"xcopy_right": "-999",
			"xsinger_id": "-999"
		}, {
			"xqusic_mid": "001rVHgt15aRmM ",
			"xqusic_id": "699379606",
			"xctype": "5",
			"xexpire_time": "0",
			"xdesc": " ",
			"xsinger_name": "soso ",
			"xsong_name": "8446666.mp3 ",
			"xsong_url": "http://streamrdt.music.qq.com/8138.83a798500d5cb2b63f442ec3ee215a8d/1081067841532582226/8138.83a798500d.html ",
			"xsong_size": "0",
			"xsong_playtime": "0",
			"xsong_diskname": "0",
			"xsong_dissmid": "0047airw212ppN ",
			"xsong_dissid": "0",
			"xis_word": "-999",
			"xcopy_right": "-999",
			"xsinger_id": "-999"
		}],
		"systemtime": "1532582226"
	}
}

接口地址:http://10.152.21.175:5000/ui/#/

Usage to aws iot(aws iot MQTT Demo)

/*AWS IOT订阅者*/
console.log("===========AWS IOT订阅者=============");
clientiot.awsIotSubscriber(function (topic, res) {
    console.log(topic);
    console.log(res);
});

/*AWS IOT发布者*/
console.log("===========AWS IOT发布者发布消息=============");
clientiot.awsIotPublisher("im_mnt_foss","我是发布者",function (topic, res) {
    console.log(res);
});

//发布者接收订阅者的消息
console.log("===========AWS IOT发布者接收订阅者的消息=============");
clientiot.awsIotPublisher.getMessages(function (topic, res) {
    console.log(topic);
    console.log(res);
});