Getting "NSURLErrorDomain error 1" while connecting WebSocket
I am trying to connect WebSocket using URLSessionWebSocketTask for a Safari Web Extension,
And I have added receive function for getting messages, like this
webSocketTask.receive { result in
switch result {
case .failure(let error):
print("Failed to receive message: \(error.localizedDescription)")
case .success(let message):
.
.
and the rest of the code...
And I am getting error.localizedDescription like this:
"The operation couldn’t be completed. (NSURLErrorDomain error 1.)".
My URL for socket connection is like this (myconnection is placeholder here for actual value, as I can't share it here):
wss://127.0.0.1:10001" + "/myconnection"
This looks like a very generic message on failure.
Can anyone help me find out what this "error 1" code means?
MacBook Pro 16″, macOS 13.4