向Rocket.Chat推送消息

2020-11-13 20:01:39

如何从后台访问接口,向Rocket.Chat推送消息

参考地址 https://www.cnblogs.com/zzhaolei/p/11068204.html

Rocket.Chat推送消息 Rocket.Chat是一个开源实时通讯平台, 支持Windows, Mac OS, Linux. 支持聊天, 文件上传, 视频通话, 语音通话功能. 向Rocket.Chat推送消息 以下示例可以转为别的语言的版本, 本示例使用Linux平台的curl测试, curl非常强大. 登陆 首先需要登陆Rocket.Chat服务器: curl http://localhost:3000/api/v1/login -d "username=YourUserName&password=YourPassWord" # 会返回一个json数据, 包含了userId和Token { "status": "success", "data": { "userId": "YourUserID", "authToken": "YourAuthToken" } } 发送信息 使用返回的userId和authToken, 构造新的请求: curl -H "X-Auth-Token: YourAuthToken" \ -H "X-User-Id: YourUserID" \ -H "Content-type:application/json" \ http://localhost:3000/api/v1/chat.postMessage \ -d '{ "channel": "#测试", "text": "This is a test! @all" }' # 返回, 会包含时间戳, 频道, 信息的id, 发送的用户, @的用户等信息 { "ts": 1531986688452, "channel": "#测试", "message": { "alias": "", "msg": "This is a test! @all", "attachments": [], "parseUrls": true, "groupable": false, "ts": "2018-07-19T07:51:28.447Z", "rid": "xxxxx", "u": { "_id": "YourChatId", "username": "YourChatName", "name": "xxxx" }, "unread": true, "mentions": [{ "_id": "all", "username": "all" }], "channels": [], "_updatedAt": "2018-07-19T07:51:28.448Z", "_id": "YourChatId" }, "success": true }

  • 2018-12-07 22:19:33

    修改 Nginx 进程最大可打开文件数(worker_processes和worker_connections)

    worker_processes:操作系统启动多少个工作进程运行Nginx。注意是工作进程,不是有多少个nginx工程。在Nginx运行的时候,会启动两种进程,一种是主进程master process;一种是工作进程worker process。例如我在配置文件中将worker_processes设置为4,启动Nginx后,使用进程查看命令观察名字叫做nginx的进程信息,我会看到如下结果:

  • 2018-12-07 22:55:02

    nginx worker_processes 配置

    据另一种说法是,nginx开启太多的进程,会影响主进程调度,所以占用的cpu会增高, 这个说法我个人没有证实,估计他们是开了一两百个进程来对比的吧。

  • 2018-12-08 11:44:26

    php 时间函数strtotime 使用详解

    这篇文章介绍的内容是关于php 时间函数strtotime 使用详解 ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下