Closed panthesingh closed 10 years ago
@panthesingh Do you have an example case you can upload that exhibits this issue? The fact it's passing all of the autobahn tests and I just tested it myself and it closes connections just fine is peculiar.
What makes you believe it's not closing the connections? Is it not sending a delegate message or is the server not getting a notification that it's been closed?
Also are you immediately destroying the PSWebSocket instance while the close command is sent? Unlike SocketRocket PSWebSocket does not retain itself while the connection is open so if you dealloc it immediately after calling close it will drop the socket connection likely before the close command is transported.
If the connection is dropped unexpectedly the other end normally wont know until it attempts to write another message.
@panthesingh Can you provide a full example of your Objective-C class? Still hard to tell if you're potentially deallocing the PSWebSocket instance.
By default I thought unless you specify a storage strength @properties are assign
which would mean the instance is getting immediately deallocated potentially. I could be wrong here though.
Can you change @property (nonatomic)
to @property (strong, nonatomic)
and see if it helps? If not I'll dig into this a bit more later today.
Hey @panthesingh
If you could zip up and send your sample project to robert[at]zwopple[dot]com that would be amazing.
The run loop should never get cleaned up, it's shared across all PSWebSocket instances and never gets removed.
@panthesingh Ok can confirm it's not closing properly. So strange as the Autobahn tests are passing 100%.. will dig into it a bit further in regards to the websocket RFC and see if it's the client or server that is being fishy.
@panthesingh This is now resolved in master. It was a really simple fix. Also in addition to sending the close to the server it will enforce a 30 second limit after which the client will forcefully drop the socket connection.
Given it was an exec bad access the run loop was getting dealloced somehow, to hopefully prevent it I stored a strong reference to the run loop and that should hopefully resolve it.
If it still ever crashes let me know
I am using this as my WebSocket Server -> https://github.com/einaros/ws
The PocketSocket client connects to the server but for some reason when I call
[self.socket close]
or[self.socket closeWithCode:1000 reason:nil]
nothing happens.I was previously using SocketRocket and the close method works correctly with this same server.