TF-3493 Ensures that a URI always uses wss:// or ws://, helping avoid the error Unsupported URL scheme 'https'

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-02-21 11:37:54 +07:00
committed by Dat H. Pham
parent 83ec6016af
commit 535a862777
3 changed files with 43 additions and 2 deletions
@@ -30,4 +30,11 @@ extension URIExtension on Uri {
return false;
}
}
Uri ensureWebSocketUri() {
if (scheme == 'ws' || scheme == 'wss') {
return this;
}
return replace(scheme: 'wss');
}
}