Uploaded image for project: 'GPII - Global Public Inclusive Infrastructure'
  1. GPII - Global Public Inclusive Infrastructure
  2. GPII-2363

Update gpii.nexusWebSocketBoundComponent to communicate when it can't connect to the Nexus

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Nexus
    • Labels:
      None

      Description

      At the moment, if a gpii.nexusWebSocketBoundComponent is unable to make a connection to the Nexus, it fails silently. The component will appear to have been instantiated properly but it has no Nexus connection.

      There are 2 requests made to the Nexus:

      1. Construct the peer (if managesPeer is true)
      2. WebSocket connection to the peer model

      The peer is constructed with a call to gpii.nexus.utils.sendRequestWithJsonBody(), which uses http.request() to make the request. Here we can do:

      var req = http.request(options);
      
      req.on("error", function () {
          // TODO: Reject promise
      });
      
      req.on("response", function () {
          promise.resolve(null);
      });
      

      For the WebSocket connection, I think we can do:

      that.websocket.onerror = function () {
          // TODO: Communicate error
      };
      

      And we should also do:

      that.websocket.onopen = function () {
          onWebsocketConnectedEvent.fire();
      };
      

      Rather than always firing onWebSocketConnectedEvent immediately after making the WebSocket.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              simon Simon Bates
              Reporter:
              simon Simon Bates
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: