簡易檢索 / 詳目顯示

研究生: 陳宥銘
Chen, Yu-Ming
論文名稱: 基於MQTT協定實作聊天APP
Implementation of Chatting App based on MQTT Protocol
指導教授: 廖德祿
Liao, Teh-Lu
學位類別: 碩士
Master
系所名稱: 工學院 - 工程科學系
Department of Engineering Science
論文出版年: 2020
畢業學年度: 108
語文別: 中文
論文頁數: 73
中文關鍵詞: 物聯網MQTTHiveMQAndroid Studio通訊軟體
外文關鍵詞: Internet of Thing, MQTT, HiveMQ, Android Studio, Communication software
相關次數: 點閱:104下載:0
分享至:
查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報
  • 在這個資訊時代,大數據、AI、物聯網等等技術蓬勃發展。人手一支的智慧型手機,也改變了許多人們的生活習慣,交友、連絡方式等等,以往人與人見面聊天的互動模式,也逐漸被通訊軟體給取代。時至今日,通訊軟體已經不只被拿來用於閒聊聯繫感情,人們也用它來討論公事,甚至交辦工作事項、傳送公司內部公文文件等等,也因此,通訊軟體的隱私問題也日益重要。而市面上常見的通訊軟體皆為無法自行重製的套裝軟體,其數據傳輸、通訊方式,資料儲存等,均掌握於開發的公司,因而具敏感資訊或機密訊息的隱私性不易受到保障。基於資訊安全的需求,國內外大型的公司或機構,便著手進行發展私有的通訊平台
    且近年來不斷蓬勃發展的,各式各樣的手機應用程式(APP, application),不論是客服專區,或是手機遊戲中玩家們彼此的溝通聯絡,交友軟體的配對與對話等等,也都需要有自己的聊天平台。
    而常見於物聯網的傳輸協定「訊息序列遙測傳輸」(MQTT, Message Queuing Telemetry Transport)不只適用於物聯網,它的訂閱/發布的訊息推播機制,也同樣適合用於聊天平台裡。
    本論文結合手機APP以及物聯網傳輸協定MQTT,以HiveMQ為MQTT server,自己設計主題架構,並以Android Studio自行編寫手機端應用程式,實作一個聊天APP。

    In this thesis, the content is divided into two parts: implementation of a chatting platform by using MQTT internet protocol (sever part), and development of the chatting APP (client part). For the server part, the review of MQTT, including description of the MQTT mechanisms, the “subscribe/publish” message spreading mechanism, topic level & topic level wildcard, and MQTT package types, etc are first introduced. Then the adopted server, HiveMQ, is described, including method of building HiveMQ server and extension of its functions. Lastly, one of the adopted extensions—RBAC extension and the self-design topic level structure are illustrated. For the client part, the APP developing software, Android Studio is introduced first. Then the mechanisms used in this APP, such as activity, recyclerView, SQLite, etc are written. Lastly, the functionality of the APP and the mechanisms used in the APP are explained.
    At the end, after verifying and analyzing the feasibility of the chatting platform, the working principle of the MQTT chatting platform and the user friendly interface of the APP are successfully developed.

    中文摘要 i EXTENDED ABSTRACT ii 誌謝 vii 目錄 viii 表目錄 x 圖目錄 xi 第1章、 緒論 1 1.1 研究動機與目的 1 1.2 研究方法 1 1.3 論文架構 2 第2章、 文獻回顧 3 2.1 基礎概論簡介 3 2.1.1 網路架構分層模型 3 2.1.2 物聯網及物聯網通訊協定 4 2.1.3 現行通訊軟體現況 4 2.2 MQTT 6 2.2.1 簡介 6 2.2.2 主題階層 7 2.2.3 訊息(封包)格式 8 2.2.4 傳輸品質 11 2.3 Android app與Android Studio簡介 13 2.3.1 Android Studio簡介 13 2.3.2 Android四大元件 14 2.3.3 Activity生命週期 15 2.3.4 RecyclerView 18 2.3.5 SQLite 19 2.3.6 Gson與JSON格式 21 第3章、 實作過程 22 3.1 MQTT Server架設與實現 22 3.1.1 不同MQTT server比較 22 3.1.2 HiveMQ 23 3.1.3 HiveMQ extension 23 3.1.4 HiveMQ RBAC extension 26 3.1.5 主題層級設計 28 3.2 Android APP端實現 34 3.2.1 程式源碼各檔案功能簡介 34 3.2.2 Activity架構 35 3.2.3 訊息的傳送、接收與處理 (JSON格式) 37 3.2.4 訊息存儲架構 40 3.2.5 圖片處理 43 第4章、 實作結果 44 4.1 App端功能與特色 44 4.2 從伺服器端觀看整體系統運行概況 45 4.3 驗證與分析 47 4.3.1 驗證QoS1 47 4.3.2 比較不同IP差異 & 效能分析 50 第5章、 結論與未來方向 55 5.1 結論 55 5.2 未來方向 55 5.2.1 伺服器端(MQTT server): 55 5.2.2 客戶端(Android APP): 56 參考文獻 58 附錄 59 HiveMQ的架設步驟 59 HelloWorld Extension的構建步驟 63 APP操作演示 66

    [1] N. Briscoe, “Understanding The OSI 7-Layer Model,” PC Network Advisor, 7 2000.
    [2] 林宏儒, “結合混沌同步與屬性加密增強MQTT安全性,” 2019.
    [3] OASIS, “MQTT Version 3.1.1 Plus Errata 01,” 10 12 2015. [線上]. Available: http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/mqtt-v3.1.1.html.
    [4] OASIS, “MQTT Version 5.0,” 7 3 2019. [線上]. Available: https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html.
    [5] 王安邦, Android App開發之鑰, 台北: 深石數位, 2018.
    [6] N. Sabiyath Fatima, D. Steffy, D. Stella, S. Nandhini Devi, “Enhanced Performance of Android Application Using RecyclerView,” Advanced Computing and Intelligent Engineering, pp. 189-199, 2018.
    [7] Hensen, “Android基础控件——RecyclerView实现拖拽排序侧滑删除效果,” [線上]. Available: https://blog.csdn.net/qq_30379689/article/details/52463139?fbclid=IwAR0apcsQ03kTZ2-sJDscC2WyslZJ1OOr2wp7n9sP6UAeglyAlhBrOYpB4YI.
    [8] M. Owens, The definitive guide to SQLite, New York: Apress, 2006.
    [9] J. V. M. S. J. Masner, “Spatial Data Monitoring and Mobile Applications – Comparison of Methods for Parsing JSON in Android Operating System,” AGRIS on-line Papers in Economics and Informatics, 06, 1, pp. 37-46, 31 3 2014.
    [10] 三顆豆子, “MQTT Broker的需求和各大Broker對比,” 9 3 2019. [線上]. Available: http://www.bewindoweb.com/244.html.
    [11] HiveMQ, “HiveMQ extension general concept,” [線上]. Available: https://www.hivemq.com/docs/hivemq/4.2/extensions/general.html.
    [12] HiveMQ, “HiveMQ RBAC Extension,” [線上]. Available: https://www.hivemq.com/extension/file-rbac-extension/.
    [13] HiveMQ, “HiveMQ extension developer guide,” [線上]. Available: https://www.hivemq.com/docs/hivemq/4.2/extensions/introduction.html.

    下載圖示 校內:2025-08-25公開
    校外:2025-08-25公開
    QR CODE