How to use the rsocket-core.serializeFrame 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-js / packages / rsocket-websocket-client / src / RSocketWebSocketClient.js View on Github external
_writeFrame(frame: Frame): void {
    try {
      if (__DEV__) {
        if (this._options.debug) {
          console.log(printFrame(frame));
        }
      }
      const buffer = this._options.lengthPrefixedFrames
        ? serializeFrameWithLength(frame, this._encoders)
        : serializeFrame(frame, this._encoders);
      invariant(
        this._socket,
        'RSocketWebSocketClient: Cannot send frame, not connected.',
      );
      this._socket.send(buffer);
    } catch (error) {
      this._close(error);
    }
  }
}
github rsocket / rsocket-js / packages / rsocket-websocket-server / src / RSocketWebSocketServer.js View on Github external
_writeFrame(frame: Frame): void {
    try {
      const buffer = serializeFrame(frame, this._encoders);
      this._socket.send(buffer);
    } catch (error) {
      this._handleError(error);
    }
  }