How to use the rsocket-core.BufferEncoder.decode function in rsocket-core

To help you get started, we’ve selected a few rsocket-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rsocket / rsocket-rpc-js / rsocket-rpc-js / packages / frames / src / Metadata.js View on Github external
export function getMetadata(buffer: Buffer): Buffer {
  let offset = VERSION_SIZE;

  const serviceLength = buffer.readUInt16BE(offset);
  offset += SERVICE_LENGTH_SIZE + serviceLength;

  const methodLength = buffer.readUInt16BE(offset);
  offset += METHOD_LENGTH_SIZE + methodLength;

  const tracingLength = buffer.readUInt16BE(offset);
  offset += TRACING_LENGTH_SIZE + tracingLength;

  return BufferEncoder.decode(buffer, offset, buffer.length);
}
github rsocket / rsocket-rpc-js / rsocket-rpc-js / packages / frames / src / Metadata.js View on Github external
export function getTracing(buffer: Buffer): Buffer {
  let offset = VERSION_SIZE;

  const serviceLength = buffer.readUInt16BE(offset);
  offset += SERVICE_LENGTH_SIZE + serviceLength;

  const methodLength = buffer.readUInt16BE(offset);
  offset += METHOD_LENGTH_SIZE + methodLength;

  const tracingLength = buffer.readUInt16BE(offset);
  offset += TRACING_LENGTH_SIZE;

  return BufferEncoder.decode(buffer, offset, offset + tracingLength);
}