Details
-
Improvement
-
Resolution: Done
-
Major
-
None
-
None
-
None
Description
wss/ws scheme enforcing on the replicator url is confusing, when actual communication is running on top of http/https and the ws scheme is used for internal communication and more of implementation detail that no user should care of.
From my long term experience as a developer, I would use a configuration setting with defaults, if I want to determine the right protocol. anyway - Couchbase lite 2.0 only supports 2.0 of the protocol anyway.
That enforcement makes the application builder life a bit more difficult when you have quite popular authenticators such as pulseSecure which doesn't support ws transport at all (screen grab attached), and give you an https url scheme when you try to access them. make the project makers to write an "unclean" lines of code (like "url.replace("http","ws")")
So let's assume that small piece of code from .net
var targetEndpoint = new URLEndpoint(new Uri("ws://localhost:4984/awesomeDB"));
var replConfig = new ReplicatorConfiguration(database, targetEndpoint);
replConfig.Authenticator = new BasicAuthenticator("john", "pass");
replicator.Start();
let's take the first line:
var targetEndpoint = new URLEndpoint(new Uri("http://localhost:4984/awesomeDB"));
that would give me an exception
if the url is being resolved:
var thirdPartyUrl = GetSomeHttpUrl(();
var targetEndpoint = new URLEndpoint(new Uri(thirdPartyUrl));
it won't work as well.
i will have to add an unsafe line of code like, which is not a good practice.
var thirdPartyUrl = GetSomeHttpUrl(().replace("http","ws");
var targetEndpoint = new URLEndpoint(new Uri(thirdPartyUrl));
Those line of code, will make a bit of an uproar among some coders, and I agree with them.
Thanks,
Roi.