refuseProtocolMismatch method
Refuses a client that speaks another Protocol.protocolVersion, and says whether it did.
The first thing a session checks: two peers that do not agree on the frames cannot agree on anything carried inside them.
Implementation
@protected
Future<bool> refuseProtocolMismatch({
required String documentId,
required int clientVersion,
}) async {
if (clientVersion == Protocol.protocolVersion) {
return false;
}
await refuse(
documentId: documentId,
code: Protocol.errorUnsupportedProtocolVersion,
reason: 'The client speaks protocol version $clientVersion, '
'this server speaks ${Protocol.protocolVersion}.',
);
return true;
}