lib/client/signalflow/websocket_message_parser.js
function extractBinaryFields(target, spec, data) {
  var offset = 0;

  for (var x = 0; x < spec.length; x++) {
    var item = spec[x];
    if (item.label) {
      if (item.type === 'string') {
        var bytes = new DataView(data.buffer, offset, item.size);
        var str = textDecoder.decode(bytes);
        target[item.label] = str.replace(/\0/g, '');
      } else {
        target[item.label] = data['get' + item.type + (item.size * 8)](offset);
      }
    }
    offset += item.size;
  }

  return offset;
}
function extractBinaryFields(target, spec, data) {
  var offset = 0;

  for (var x = 0; x < spec.length; x++) {
    var item = spec[x];
    if (item.label) {
      if (item.type === 'string') {
        var bytes = new DataView(data.buffer, offset, item.size);
        var str = textDecoder.decode(bytes);
        target[item.label] = str.replace(/\0/g, '');
      } else {
        target[item.label] = data['get' + item.type + (item.size * 8)](offset);
      }
    }
    offset += item.size;
  }

  return offset;
}
function extractBinaryFields ( target , spec , data ) { var offset = 0 ; for ( var x = 0 ; x < spec . length ; x ++ ) { var item = spec [ x ] ; if ( item . label ) { if ( item . type === 'string' ) { var bytes = new DataView ( data . buffer , offset , item . size ) ; var str = textDecoder . decode ( bytes ) ; target [ item . label ] = str . replace ( / \0 / g , '' ) ; } else { target [ item . label ] = data [ 'get' + item . type + ( item . size * 8 ) ] ( offset ) ; } } offset += item . size ; } return offset ; }
Extract fields from the given DataView following a specific a binary format
specification into the given target object.
Extract fields from the given DataView following a specific a binary format specification into the given target object .