Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

EWD 3 Training Course Part 6: What Happens when a QEWD Application is Started

644 views

Published on

This presentation is part 6 of the EWD 3 Training Course. It explains what happens in both the browser and QEWD back-end when a QEWD application is loaded and started.

Published in: Software
  • Be the first to comment

EWD 3 Training Course Part 6: What Happens when a QEWD Application is Started

  1. 1. Copyright © 2016 M/Gateway Developments Ltd EWD 3 Training Course Part 6 What Happens when a QEWD Application is Started Rob Tweed Director, M/Gateway Developments Ltd Twitter: @rtweed
  2. 2. Copyright © 2016 M/Gateway Developments Ltd QEWD Application Startup • Triggered by EWD.start() function in ewd-client – Creates the client environment • Everything protected within a closure – Establishes a web socket connection to QEWD back- end – Registers the client application within QEWD
  3. 3. Copyright © 2016 M/Gateway Developments Ltd Application registration Browser QEWD Caché, GT.M or Redis EWD.start() Master process Worker process
  4. 4. Copyright © 2016 M/Gateway Developments Ltd Application registration Browser QEWD socket.io socket.io Browser makes web-socket connection to back-end Caché, GT.M or Redis
  5. 5. Copyright © 2016 M/Gateway Developments Ltd Application registration Browser QEWD socket.io socket.io Browser sends WebSocket message type: ‘ewd-register’ application: ‘demo1’ Caché, GT.M or Redis
  6. 6. Copyright © 2016 M/Gateway Developments Ltd Application registration Browser QEWD socket.io socket.io Message queued and passed to available worker type: ‘ewd-register’ application: ‘demo1’ Caché, GT.M or Redis
  7. 7. Copyright © 2016 M/Gateway Developments Ltd Application registration Browser QEWD socket.io socket.io New QEWD Session created application: ‘demo1’ ewd-session Stored in global named 'CacheTempEWDSession' Caché, GT.M or Redis
  8. 8. Copyright © 2016 M/Gateway Developments Ltd Application registration Browser QEWD socket.io socket.io New session token returned, eg: token: ‘a0a033a9-393a-4e7a-9252-848c24ee5b02’ ewd-session Caché, GT.M or Redis
  9. 9. Copyright © 2016 M/Gateway Developments Ltd Application registration Browser QEWD socket.io socket.io Token returned to browser token: ‘a0a033a9-393a-4e7a-9252-848c24ee5b02’ Caché, GT.M or Redis
  10. 10. Copyright © 2016 M/Gateway Developments Ltd Application registration Browser QEWD socket.io socket.io Token stored within Closure in browser Accessible by ewd-client APIs but not by user token Caché, GT.M or Redis
  11. 11. Copyright © 2016 M/Gateway Developments Ltd Application registration Browser QEWD socket.io socket.io token Registration completed ewd-registered event fires Caché, GT.M or Redis
  12. 12. Copyright © 2016 M/Gateway Developments Ltd Examine activity in back-end • Look at Command Prompt or terminal window in which you're running QEWD: Should look something like this: worker 3884 received message: {"type":"ewd-register","application":"demo1","sock etId":"/#oIQ1LbMUlKew3RefAAAE"} master process received response from worker 3884: {"type":"ewd-register","finis hed":true,"message":{"token":"a0a033a9-393a-4e7a-9252-848c24ee5b02"}} *** handleMessage response {"type":"ewd-register","finished":true,"message":{"to ken":"a0a033a9-393a-4e7a-9252-848c24ee5b02"}} sending to socket /#oIQ1LbMUlKew3RefAAAE Master process has finished processing response from worker process 3884 which i s back in available pool
  13. 13. Copyright © 2016 M/Gateway Developments Ltd Examine activity in back-end worker 3884 received message: { "type":"ewd-register", "application":"demo1", "socketId":"/#oIQ1LbMUlKew3RefAAAE” } Let's examine some of those QEWD log messages (formatted for clarity) QEWD / ewd-qoper8 worker process was passed the message object - Message type was 'ewd-register', for an application named 'demo1' - SocketId is the unique web-socket Id for the client that sent the message
  14. 14. Copyright © 2016 M/Gateway Developments Ltd Examine activity in back-end master process received response from worker 3884: { "type":"ewd-register", "finished":true, "message":{ "token":"a0a033a9-393a-4e7a-9252-848c24ee5b02” } } QEWD / ewd-qoper8 worker process finished processing the request - Returned its response object to the ewd-qoper8 master process - Message/response type is 'ewd-register' - Token contains the QEWD session token
  15. 15. Copyright © 2016 M/Gateway Developments Ltd Examine activity in back-end sending to socket /#oIQ1LbMUlKew3RefAAAE QEWD returns the response object to the awaiting browser, via the web-socket connection identified by the socketId
  16. 16. Copyright © 2016 M/Gateway Developments Ltd Examine activity in back-end Master process has finished processing response from worker process 3884 which is back in available pool The ewd-qoper8 worker process has completed its processing, and the master process has completed handling the response object, so the worker process is returned to the available pool, ready to handle another incoming request.
  17. 17. Copyright © 2016 M/Gateway Developments Ltd QEWD is Now Ready for your App • Registration is complete: – Browser has a session token – Back-end has a session indexed by that token • Now let’s begin building out our application’s dynamic behaviour – See Part 7

×