app/assets/javascripts/uploadcare/vendor/pusher.js
function parseWebSocketEvent(event) {
      try {
        var params = JSON.parse(event.data);

        if (typeof params.data === 'string') {
          try {
            params.data = JSON.parse(params.data);
          } catch (e) {
            if (!(e instanceof SyntaxError)) {
              throw e;
            }
          }
        }

        return params;
      } catch (e) {
        self.emit('error', {type: 'MessageParseError', error: e, data: event.data});
      }
    }
function parseWebSocketEvent(event) {
      try {
        var params = JSON.parse(event.data);

        if (typeof params.data === 'string') {
          try {
            params.data = JSON.parse(params.data);
          } catch (e) {
            if (!(e instanceof SyntaxError)) {
              throw e;
            }
          }
        }

        return params;
      } catch (e) {
        self.emit('error', {type: 'MessageParseError', error: e, data: event.data});
      }
    }
function parseWebSocketEvent ( event ) { try { var params = JSON . parse ( event . data ) ; if ( typeof params . data === 'string' ) { try { params . data = JSON . parse ( params . data ) ; } catch ( e ) { if ( ! ( e instanceof SyntaxError ) ) { throw e ; } } } return params ; } catch ( e ) { self . emit ( 'error' , { type : 'MessageParseError' , error : e , data : event . data } ) ; } }
Parses an event from the WebSocket to get
the JSON payload that we require

@param {MessageEvent} event  The event from the WebSocket.onmessage handler.
Parses an event from the WebSocket to get the JSON payload that we require