Looks like a pretty significant changeset came in from 3.1.1 -> 4.0.0, but the README doc was not properly updated to indicate the new usage. I'm currently working through what I have to migrate and will submit a PR when I have time, but thought opening an issue was a good start.
Just adding as a reminder because i ran into it today .enableCompression is no longer a property on a WebSocket instance
I also noticed that the url string constructor is no longer available too? Was this intended? I see we now have to pass a URLRequest
Also, the disableSSLCertValidation option is missing and it was useful during development stage
isConnected is also not a property on the socket as well
Self-signed certificate is not working when instance init by:
self.init(request: request, engine: WSEngine(transport: FoundationTransport(), certPinner: certPinner, compressionHandler: compressionHandler))
Should changelog be updated too?
I'm not sure if I should update my projects pod to 4.0 or just leave at 3.1.1.
Thanks
Looks like 4.0 version isn't production-ready. Getting a lot of errors e.g. "POSIXErrorCode: Software caused connection abort". Wouldn't recommend to update from 3.1.1. Waiting for fixes
After solving:
@ergunkocak would you mind posting a code snippet/example for the first two items in the list (self signed and connection.state)? Would be greatly appreciated!
Self signed certificate parameter
self.webSocket = WebSocket(url: encodedURLRequest.url!)
becomes
self.webSocket = WebSocket(request: URLRequest(url: encodedURLRequest.url!), certPinner: FoundationSecurity(allowSelfSigned: true))
connection.state check
public override func send(_ connection: SRConnectionInterface, data: String, connectionData: String, completionHandler block: SRWebSocketStartBlock?) {
if let socket = webSocket, socket.isConnected {
socket.write(string: data)
}
becomes
public override func send(_ connection: SRConnectionInterface, data: String, connectionData: String, completionHandler block: SRWebSocketStartBlock?) {
if let socket = webSocket, connection.state == .connected {
socket.write(string: data)
}
SRConnectionInterface is a part of https://github.com/skerkewitz/SwignalR
Thanks @ergunkocak!
WebSocketDelegate's callback method's error also changed to Error type form NSError.
After solving:
- Self signed certificate parameter
- connection.state check instead of weboSocket.isConnected
- new delegate event switch
everything seems fine
馃憤
I need to know how do you that.
Thanks @ergunkocak for answering these questions. I updated the README a bit with some examples of the new API.
Most helpful comment
Also, the
disableSSLCertValidationoption is missing and it was useful during development stage