Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(config: ClientConfig, connection: DuplexConnection) {
this._machine = createClientMachine(
connection,
subscriber => connection.receive().subscribe(subscriber),
config.serializers,
config.responder,
);
// Send SETUP
connection.sendOne(this._buildSetupFrame(config));
// Send KEEPALIVE frames
const {keepAlive} = config.setup;
const keepAliveFrames = every(keepAlive).map(() => ({
data: null,
flags: FLAGS.RESPOND,
lastReceivedPosition: 0,
streamId: CONNECTION_STREAM_ID,
type: FRAME_TYPES.KEEPALIVE,
}));
connection.send(keepAliveFrames);
}
this._machine = createClientMachine(
connection,
subscriber => connection.receive().subscribe(subscriber),
lifetime,
config.serializers,
config.responder,
config.errorHandler,
requesterLeaseHandler,
responderLeaseHandler,
);
// Send SETUP
connection.sendOne(this._buildSetupFrame(config));
// Send KEEPALIVE frames
const keepAliveFrames = every(keepAlive).map(() => ({
data: null,
flags: FLAGS.RESPOND,
lastReceivedPosition: 0,
streamId: CONNECTION_STREAM_ID,
type: FRAME_TYPES.KEEPALIVE,
}));
connection.send(keepAliveFrames);
}