Proper way to close/destroy/deallocate WebSocket
Hello, I'm using this class inside another object that I'm instantiating. When I attempt to destroy my object, the deinit() is never called. If I do not create the WebSocket(), I can see deinit() is properly called. I'm calling ws.close() but I don't think that's enough to clear out/free all the objects associated with WebSocket(). I also cannot set ws = nil (I thought that would do it)
What is the proper method of deallocating WebSocket?
I think the problem can come from the delegate property which is a default one and so strong https://github.com/tidwall/SwiftWebSocket/blob/master/Source/WebSocket.swift#L1809-L1811 The property should be weak tagged to my mind.
@utdrmac Is the container class you use an obj-c one?
@gsempe I'm all Swift 3.0. Latest XCode as of Dec 24th 2016.
Facing the same prob. @utdrmac How did you move forward with this?
@GoNinja Unfortunately I didn't. I abandoned the project I was working on that used this library.
BTW @utdrmac I found a solution that worked for me.
Just made the socket reference an optional, and in my viewcontroller on willdisappear I manually closed the connection and set it to nil