Abhinav Dobhal
Abhinav Dobhal

Reputation: 630

Get onerror callback/delegate for URLSessionWebSocketTask

I am trying to connect Websocket using URLSessionWebSocketTask in my Safari extension app. But when the socket is not able to connect due to any reason, I am not sure which method to use.

There are only two methods in the URLSessionWebSocketTask delegate, i.e., didOpenWithProtocol and didCloseWith, and they are only called when the connection is forming correctly.

But in error case, there are no logs or callbacks, like there are events with JS (onerror, onclose) etc.

Has anyone come across this type of issue?

I have also tried using didCompleteWithError method of URLSession, but no luck.

Upvotes: 0

Views: 35

Answers (0)

Related Questions