2929/**
3030 * Not sure what this does
3131 *
32- * @type {null }
32+ * @type {WebSocket }
3333 */
3434var client_ws_connection = null ;
3535
3636
3737// TODO: Uninitialized variable
3838// TODO: Document what the 'client_ws_heatbeat' variable represents
3939/**
40- *
40+ * @type { number }
4141 */
4242var client_ws_heartbeat ;
4343
4444
45-
45+ /**
46+ *
47+ * @type {number }
48+ */
4649var client_ws_heartbeat_interval = null ;
4750
51+
4852var check_com_ports_interval = null ;
4953var check_ws_socket_timeout = null ;
5054
@@ -57,12 +61,12 @@ var launcher_download = false;
5761 * Client Service Object
5862 */
5963var clientService = {
64+ available : false , // Available for ?
65+ portsAvailable : false , // Are any serial ports enumerated?
66+ path : 'localhost' , // Is this always localhost?
67+ port : 6009 , // BlocklyProp Client/Launcher port number
68+ type : null , // {string} Seems to be one of "", "ws", "http"
6069
61- available : false ,
62- portsAvailable : false ,
63- path : 'localhost' ,
64- port : 6009 ,
65- type : null ,
6670 /*
6771 rxBase64: true,
6872 portListReceiveCountUp: 0, // This is set to 0 each time the port list is received, and incremented once each 4 second heartbeat
@@ -78,11 +82,12 @@ var clientService = {
7882 CODED_MINIMUM : '0.7.5' , // Minimum client/launcher version supporting coded/verbose responses (remove after MINIMUM_ALLOWED > this)
7983
8084 // Variables
81- current : '0.0.0' ,
85+ current : '0.0.0' , // Current version
8286 currentAsNumber : 0 ,
83- isValid : false ,
84- isRecommended : false ,
85- isCoded : false ,
87+ isValid : false , // What determines this?
88+ isRecommended : false , // What is this?
89+ isCoded : false , // Also, what is this?
90+
8691 getNumeric : function ( rawVersion ) {
8792 var tempVersion = rawVersion . toString ( ) . split ( "." ) ;
8893 tempVersion . push ( '0' ) ;
@@ -197,6 +202,7 @@ function checkClientVersionModal(rawVersion) {
197202 * This is evaluating the BlocklyProp Client or BlocklyProp Launcher version??
198203 */
199204var check_client = function ( ) {
205+ // Load data from the server using a HTTP GET request.
200206 $ . get ( clientService . url ( ) , function ( data ) {
201207 if ( ! clientService . available ) {
202208 let client_version_str = ( typeof data . version_str !== "undefined" ) ? data . version_str : data . version ;
@@ -231,11 +237,11 @@ var connection_heartbeat = function () {
231237 if ( clientService . type === 'ws' ) {
232238 var d = new Date ( ) ;
233239 if ( client_ws_heartbeat + 12000 < d . getTime ( ) ) {
234- console . log ( "Lost client websocket connection" ) ;
235240 // Client is taking too long to check in - close the connection and clean up
241+ console . log ( "Lost client websocket connection" ) ;
236242 client_ws_connection . close ( ) ;
237243 lostWSConnection ( ) ;
238- }
244+ `` }
239245 }
240246} ;
241247
@@ -463,11 +469,13 @@ function establish_socket() {
463469function lostWSConnection ( ) {
464470// Lost websocket connection, clean up and restart find_client processing
465471 client_ws_connection = null ;
472+
466473 clientService . type = 'none' ;
467474 clientService . available = false ;
468475 clientService . portsAvailable = false ;
469476
470477 setPropToolbarButtons ( 'unavailable' ) ;
478+
471479 term = null ;
472480 newTerminal = false ;
473481
0 commit comments