• Robert Knight's avatar
    Replace angular-websocket with a minimal WebSocket wrapper · 379bd246
    Robert Knight authored
    We used to have our own WebSocket wrapper, which was replaced in
    cf410d0bd2127973739208ef94b2df59cc0b720e with angular-websocket,
    since that provided the functionality that we needed on top
    of WebSockets, namely:
    
     * Integration with Angular $scope by wrapping onmessage callbacks
       with $scope.$apply()
    
     * Automatic reconnection in the event of a disconnection
    
     * Queuing of messages sent prior to a connection being established.
    
    Unfortunately, angular-websocket also brings in a somewhat unnecessary
    dependency on the "ws" module. That got out of date and resulted in no longer
    being able to build H with the current version of Node.
    See https://github.com/AngularClass/angular-websocket/issues/47
    
    This gave us either the choice of fixing angular-websocket or
    replacing the dependency.
    
    This commit removes the angular-websocket dependency in favor of
    our own WebSocket wrapper, but unlike before, we outsource the retry logic
    to the "retry" package. A benefit of this is that we get better logging
    of what is going on during automated reconnects.
    379bd246
websocket-test.js 1.6 KB