sendSimulateScenario method
To be used for internal testing purposes only.
Client side scenarios, no server involvement:
signalReconnectdrops the signal socket, the engine resumes.fullReconnectdrops the signal socket with a full reconnect pending.
Server side scenarios, forwarded as a SimulateScenario request. What the
server does with them depends on the deployment; the open source server
and Cloud differ for migration and nodeFailure.
disconnectSignalOnResumearms the server to close the signal socket right after answering the next resume, once its response messages have been sent. The socket is dropped immediately after arming so the resume starts, matching client-sdk-js.disconnectSignalOnResumeNoMessagesis the same, but the server closes the socket before sending anything, for the next three resumes.leaveRequestFullReconnectmakes the server send aLeave{RECONNECT}.
Implementation
Future<void> sendSimulateScenario({
int? speakerUpdate,
bool? nodeFailure,
bool? migration,
bool? serverLeave,
bool? switchCandidate,
bool? signalReconnect,
bool? fullReconnect,
int? subscriberBandwidth,
bool? disconnectSignalOnResume,
bool? disconnectSignalOnResumeNoMessages,
bool? leaveRequestFullReconnect,
}) async {
if (signalReconnect != null && signalReconnect) {
await engine.signalClient.cleanUp();
return;
}
if (fullReconnect != null && fullReconnect) {
engine.fullReconnectOnNext = true;
await engine.signalClient.cleanUp();
return;
}
engine.signalClient.sendSimulateScenario(
speakerUpdate: speakerUpdate,
nodeFailure: nodeFailure,
migration: migration,
serverLeave: serverLeave,
switchCandidate: switchCandidate,
subscriberBandwidth: subscriberBandwidth,
disconnectSignalOnResume: disconnectSignalOnResume,
disconnectSignalOnResumeNoMessages: disconnectSignalOnResumeNoMessages,
leaveRequestFullReconnect: leaveRequestFullReconnect,
);
// The server only acts on the next resume, so start one now. Mirrors the
// post action in client-sdk-js.
if ((disconnectSignalOnResume ?? false) || (disconnectSignalOnResumeNoMessages ?? false)) {
await engine.signalClient.cleanUp();
}
}