Mosquitto学习笔记

2016-03-21  本文已影响3428人  Juude

声明:

这篇笔记是我进行技术选型时候的一些记录,最终我们的推送系统并没有采用基于Mosquitto的方案,这些内容仅供参考,需要更权威消息,还请移步官网。

使用方法

mosquitto_pub

mosquitto_passwd

代码结构

数据结构

文件结构

标识符

username_flag:
connect_flags

Demos to write

  1. login with ssl
  2. use passwd to login

Connect 流程

start=>start: Start
mqtt3_packet_handle=>operation: mqtt3_packet_handle
mqtt3_handle_connect=>operation: read_handle_server#mqtt3_handle_connect
start->mqtt3_packet_handle->mqtt3_handle_connect

ACL

ACL流程

start=>start: Start
mqtt3_handle_publish=>operation: mqtt3_handle_publish
mosquitto_acl_check=>operation: mosquitto_acl_check
start->mqtt3_handle_publish->mosquitto_acl_check

ACL topic 与pattern区别

Clients

  1. 异步与同步

Questions

  1. database 放在什么地方?
  2. pid_file /var/run/mosquitto.pid 作用?
  3. 数据库的格式是什么?
    • 二进制的
  4. 为何不用mysql等数据库访问
  5. 数据库中存放了哪些信息?
  6. 所有的配置选项:./mosquitto.conf
  7. what is briges?
  8. 如何接受离线消息
    • set cleansession = False
    • set qos to 2
  9. 离线的消息是存储在哪里的?
  10. 如何让某个账号给权限获取离线消息
  11. ssl 是如何正确运行的?
  12. 从接受消息到发送消息的过程是怎样的?
  13. 启动服务器的过程是怎样的?
  14. contexts作用?
  15. WITH_SYS_TREE 干嘛的?
  16. lib目录下的是否有用
    • 有用
  17. 如何保证推送成功
    • qos0? \
  18. 数据库与sql数据库有什么关系?
  19. 如何读取$SYS信息

参考

mosquitto源码分析 : http://wenku.baidu.com/link?url=iICdhK4CbSxFfHO5-MkobVoJ8BXdZNuMHulUzfCg-oMFUpfKWvL07APDQVLur0iPG9DdYrDRiBKrZ8wD9klG6N9xdRp1Qt7TQgBN4GToahy
Mosquitto : http://eclipse.org/mosquitto/

如果对我的文章感兴趣,也可以关注 我的github.

上一篇 下一篇

猜你喜欢

热点阅读