give a push to your qt application with qt cloud services
play

Give a Push to Your Qt Application with Qt Cloud Services and - PowerPoint PPT Presentation

Give a Push to Your Qt Application with Qt Cloud Services and WebSockets About me Lauri Nevala nevalau nevalla nevalla Working in Qt Cloud Services team at The Qt Company Over ten years of experience in creating web and mobile


  1. Give a Push to Your Qt Application with Qt Cloud Services and WebSockets

  2. About me

  3. Lauri Nevala nevalau nevalla nevalla • Working in Qt Cloud Services team at The Qt Company • Over ten years of experience in creating web and mobile based applications

  4. Our Goal Understand how to use Qt Cloud Services in order to send and receive WebSocket messages

  5. What is Qt Cloud Services Enginio ¡Data ¡Storage ¡ Storage ¡for ¡Applica/on ¡Data ¡ Use ¡with ¡QtEnginio ¡Library Managed ¡Applica3on ¡Run3me ¡ Applica/on ¡Pla<orm ¡as ¡a ¡Service ¡ Support ¡for ¡Qt/C++, ¡NodeJS, ¡Apache, ¡PHP, ¡MongoDB, ¡MySQL, ¡Redis… ¡ Managed ¡WebSocket ¡ Real-­‑Time ¡Socket ¡Connec/ons ¡with ¡virtually ¡unlimited ¡scalability ¡ Use ¡with ¡SDK’s ¡and ¡Qt ¡WebSocket ¡Client ¡Library ¡

  6. Enginio Data Storage (EDS) Flexible and powerful cloud data storage 
 with built-in user and data access control

  7. Managed Application Runtime (MAR) Scalable, � Multi-language, � Multi-database, � Application Platform as a Service

  8. Managed Application Runtimes How does it work?

  9. Supported Frameworks Supported frameworks by 3rd party build packs Scala, Clojure, Play, Gradle, Grails, PHP, Go, Meteorite, Perl, Dart, Nginx, Apache, Jekyll

  10. Built-in Services or choose from our cloud based services Enginio Data Storage � Managed WebSocket or choose anything with SDK ... Amazon, Azure, Google ...

  11. Developer Friendly Deployment Deploy using Git – the most common VCS among developers > ¡git ¡push ¡qtc ¡master

  12. Mana ged WebSocket (MWS) Fully managed service implementing a bi-directional, real- time communication gateway for WebSockets.

  13. Managed WebSocket How does it work?

  14. 1. get WebSocket URI 3. send WebSocket message 4. deliver WebSocket message 2. open WebSocket connection { ¡data: ¡'{ ¡ ¡ ¡ ¡ ¡"object":{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"id":"541df1c1e5bde554a805b213", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"createdAt":"2014-­‑09 ¡20T21:29:37.849Z", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"device":"FZXC0wg0LvaJ", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"done":false, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"objectType":"objects.todos", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"text":"testi2", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"updatedAt":"2014-­‑09-­‑20T21:29:37.849Z", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"userId":"user:54196f3f5a3d8b61860381a4" ¡ ¡ ¡ ¡ ¡}, ¡ ¡ ¡ ¡ ¡"meta":{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"backendId":"5417e5485a3d8b418a01adb7", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"eventName":"create", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"requestId":"a671f67b4f41c20b53988a6057b32539", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"userId":null} ¡ ¡ ¡ ¡ ¡}', ¡ ¡ ¡ ¡ ¡receivers: ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡sockets: ¡['*'], ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡tags: ¡[] ¡ ¡ ¡ ¡ ¡ ¡} ¡ ¡ }

  15. WebSockets Consider using WebSockets for instantaneous data without the browser refresh

  16. Where to use? • Chats • Social feeds • Multiplayer games • Collaborative editing • Sport updates • Location based apps • Your killer app

  17. Why WebSockets are so great? • WebSockets defines an API establishing “socket” connections between web clients and a server • TCP-based protocol • Full-duplex, simultaneous bi-directional messaging • Uri scheme ws: and wss:

  18. WebSockets and Qt Cloud Services 1. + ➡ public socket 2. + + ➡ private socket 3. ➡ do anything you want

  19. https://flic.kr/p/dUtbk5 Public sockets

  20. +

  21. WebSocket server Create EDS instance Create MWS instance Create EDS Webhook

  22. WebSocket server Create EDS instance Create MWS instance Create EDS Webhook

  23. WebSocket server Create EDS instance Create MWS instance Create EDS Webhook

  24. Create EDS Webhook http://bit.ly/eds-mws-webhook

  25. EDS MWS App HTTP POST 
 https://mws-eu-1.qtc.io/v1/gateways/MWS_GATEWAY_ID/webhook_receivers/enginio { ¡data: ¡'{ ¡ send WebSocket message to all sockets ¡ ¡ ¡ ¡"object":{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"id":"541df1c1e5bde554a805b213", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"createdAt":"2014-­‑09 ¡20T21:29:37.849Z", ¡ { ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"device":"FZXC0wg0LvaJ", ¡ ¡ ¡ ¡ ¡"object":{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"done":false, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"id":"541df1c1e5bde554a805b213", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"objectType":"objects.todos", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"createdAt":"2014-­‑09 ¡20T21:29:37.849Z", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"text":"testi2", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"device":"FZXC0wg0LvaJ", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"updatedAt":"2014-­‑09-­‑20T21:29:37.849Z", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"done":false, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"userId":"user:54196f3f5a3d8b61860381a4" ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"objectType":"objects.todos", ¡ ¡ ¡ ¡ ¡}, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"text":"testi2", ¡ ¡ ¡ ¡ ¡"meta":{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"updatedAt":"2014-­‑09-­‑20T21:29:37.849Z", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"backendId":"5417e5485a3d8b418a01adb7", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"userId":"user:54196f3f5a3d8b61860381a4" ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"eventName":"create", ¡ ¡ ¡ ¡ ¡}, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"requestId":"a671f67b4f41c20b53988a6057b32539", ¡ ¡ ¡ ¡ ¡"meta":{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"userId":null} ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"backendId":"5417e5485a3d8b418a01adb7", ¡ ¡ ¡ ¡ ¡}', ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"eventName":"create", ¡ ¡ ¡ ¡ ¡receivers: ¡{ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"requestId":"a671f67b4f41c20b53988a6057b32539", ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡sockets: ¡['*'], ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡"userId":null} ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡tags: ¡[] ¡ ¡ ¡ ¡ ¡ ¡} ¡ ¡ ¡ ¡ ¡} ¡ ¡ } }

  26. WebSocket server Create a EDS instance Create a MWS instance Create EDS Webhook

  27. Enginio Todo http://bit.ly/qtc-todo

  28. 2. create Todo 1. connect to WebSocket 3. trigger Webhook 5. refresh UI 4. send WebSocket message

  29. websocketclient.cpp #include ¡"websocketclient.h" ¡ #include ¡<QtCore/QDebug> ¡ � QT_USE_NAMESPACE ¡ � WebSocketClient::WebSocketClient(const ¡QUrl ¡&url, ¡QObject ¡*parent) ¡: ¡ ¡ ¡ ¡ ¡QObject(parent), ¡ ¡ ¡ ¡ ¡m_url(url) ¡ { ¡ ¡ ¡ ¡ ¡connect(&m_webSocket, ¡&QWebSocket::connected, ¡this, ¡&WebSocketClient::onConnected); ¡ ¡ ¡ ¡ ¡connect(&m_webSocket, ¡&QWebSocket::disconnected, ¡this, ¡&WebSocketClient::closed); ¡ ¡ ¡ ¡ ¡m_webSocket.open(QUrl(url)); ¡ } ¡ � void ¡WebSocketClient::onConnected() ¡ { ¡ ¡ ¡ ¡ ¡qDebug() ¡<< ¡"WebSocket ¡connected"; ¡ ¡ ¡ ¡ ¡connect(&m_webSocket, ¡&QWebSocket::textMessageReceived, ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡this, ¡&WebSocketClient::onTextMessageReceived); ¡ } ¡ � void ¡WebSocketClient::onTextMessageReceived(QString ¡message) ¡ { ¡ ¡ ¡ ¡ ¡emit ¡onMessageReceived(message); ¡ }

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend