EXC_BAD_ACCESS in SRWebSocket_HTTPHeadersDidFinish #79

HaKop opened this Issue Feb 18, 2013 · 4 comments


None yet

4 participants

HaKop commented Feb 18, 2013

i'm always getting an error (see picture) while trying to establish a websocket connection.
my target is ios 6.0, using ARC and this is my code:

NSURL* url = [[NSURL alloc] initWithString:uriString];
webSocket = [[SRWebSocket alloc] initWithURL:url];
webSocket.delegate = self;
[webSocket open];



I am having the same issue, I'm looking into fixing it. I'll post if I figure something out.


Ok, I got it working. You need to make sure that your socket isn't getting deallocated, to do this use the __strong tag when making your delegate instance.

@abillingsley abillingsley referenced this issue in DyKnow/SignalR-ObjC Mar 21, 2014

Error when stopping HubConnection #162


@7imbrook, how about making delegate as weak reference? All my crashes (with SignalR-ObjC lib) appears on sending message to assigned self.delegate

diff --git a/Pods/SocketRocket/SocketRocket/SRWebSocket.h b/Pods/SocketRocket/SocketRocket/SRWebSocket.h
index 2d40bb1..4816454 100644
--- a/Pods/SocketRocket/SocketRocket/SRWebSocket.h
+++ b/Pods/SocketRocket/SocketRocket/SRWebSocket.h
@@ -36,7 +36,7 @@ extern NSString *const SRWebSocketErrorDomain;

 @interface SRWebSocket : NSObject <NSStreamDelegate>

-@property (nonatomic, assign) id <SRWebSocketDelegate> delegate;
+@property (nonatomic, weak) id <SRWebSocketDelegate> delegate;

 @property (nonatomic, readonly) SRReadyState readyState;
 @property (nonatomic, readonly, retain) NSURL *url;
@abillingsley abillingsley pushed a commit to DyKnow/SocketRocket that referenced this issue Aug 26, 2014
Alex Billingsley Make WebSocket Delegate a weak reference facebook/SocketRocket#79 7a90ce6

Doing some housekeeping. Please reopen if still relevant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment