Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_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);
}
}
}
_writeFrame(frame: Frame): void {
try {
const buffer = serializeFrameWithLength(frame, this._encoders);
invariant(
this._socket,
'RSocketTcpClient: Cannot send frame, not connected.',
);
this._socket.write(buffer);
} catch (error) {
this._handleError(error);
}
}
}