A conforming Objective-C WebSocket client library.

Library not found Error when simple building web socket chat in iOS?

i downloaded simple web socket chat code and am getting this error

  ld: library not found for -lPods-SocketRocket
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please anyone tell me how to solve this?

In my other linker flags contains these things


My code

Source: (StackOverflow)

Implementin SRWebSocketDelegate in Swift

I am implementing:

@protocol SRWebSocketDelegate <NSObject>

- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message;


- (void)webSocketDidOpen:(SRWebSocket *)webSocket;
- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error;
- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;

in Swift. All functions I can implement ok and works, but didCloseWithCode I just can't make it to work.

I am having trouble implementing

- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;

in Swift.

I am trying:

func webSocket(webSocket: SRWebSocket!, didCloseWithCode code: NSInteger!, reason: NSString!, wasClean: Bool!) {
    println("websocket closed: \(reason)")

with no luck.

Source: (StackOverflow)

Why does my websocket server always report [websocket: control frame length > 125]?

My iOS application uses SocketRocket to establish a connection with my websocket server. But after establishing a connection and sending the first message, the server (using gorilla/websocket) tries to parse the frame, but failed:

message_type, r, err := ws.NextReader()
if err != nil {
    goto end

An error is reported when calling NextReader():

Websocket Read Failed: [websocket: control frame length > 125]

The strange thing is, I use SocketRocket's send() method to send data, so there should never be any control frames (ping/pong).

Has anyone seen this problem before? Help!

Source: (StackOverflow)

Any server that I can run locally in iOS that is compliant with SocketRocket?

Is there a server that I can run inside an iPhone app (a localhost server running in iOS) that can talk to SocketRocket? I know CocoaHTTPServer comes bundled with a server and a websocket implementation. But I wish to use a different websocket library in IOS.

Source: (StackOverflow)

How to use SocketRocket with

The new iOS websocket library, SocketRocket, looks really awesome, and the chat example project is really sweet. The example chat server is written in Python, of which I know none. I'm slightly familiar with on node.js and prefer to try javascript. I tried connecting the SocketRocket TestChat simulator app to the node.js(6.10) but the connection was refused. (Also, I'm not a node expert either, so this may be a silly question).

In a recent answer to an SO question, mikelikespie said to op: "I suggest updating your stack to use the iOS WebSocket library we just released."

What does that mean exactly? What is necessary to get the SocketRocket library to talk to a node server? Any sample code or suggestions are greatly appreciated.

Source: (StackOverflow)

Difference between UnittWebSocketClient library and SocketRocket. Which one is efficient to use?

Difference between UnittWebSocketClient library and SocketRocket. Which one is efficient to use to implement WebSockets in iOS Apps?

Source: (StackOverflow)

Apple Mach-O Linker Error with the introduction of SocketRocket

I'm using Xcode Version 6.0.1 (6A317)and stuck with Apple Mach-O error for a long time. I get this error once I introduce SocketRocket project.

duplicate symbol _OBJC_IVAR_$_AppDelegate._window in:

duplicate symbol _OBJC_METACLASS_$_AppDelegate in:
duplicate symbol _OBJC_CLASS_$_AppDelegate in:
duplicate symbol _OBJC_CLASS_$_ViewController in:
duplicate symbol _OBJC_METACLASS_$_ViewController in:
duplicate symbol _main in:
ld: 6 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I have made sure to follow the steps given in

the only exception I see is SocketRocket.framework was showing red when I tried adding it under + Link Binary with libraries.

I have added the following libraries:


I've set other linker flags to -ObjC Build Active Architecture only - No, because setting it to Yes throws an error : Check dependencies. No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386). Valid Architectures - armv64 armv7 armv7s

This issue is really killing my time. I tried to follow other posts but nothing could help me solve the issue!

Source: (StackOverflow)

Sending a UILocationNotification from the background

I have an app where I need to send a UILocationNotification when the app is not in the foreground / Active. If I have my code to do so, it will not send until the app is opened and is active.

Here is my function:

- (void)setLocalNotificationForType:(SPKLocalNotificationType)notificationType fromUser:(NSString *)userName withMessageText:(NSString *)msgText {

    UILocalNotification *notif = [[UILocalNotification alloc] init];
    notif.userInfo = @{@"handle": _convoHandle, @"room": _convoName};
    notif.fireDate = [NSDate date];
    notif.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;
    notif.soundName = UILocalNotificationDefaultSoundName;
    notif.timeZone = [NSTimeZone defaultTimeZone];

    if (notificationType == 1) { // message
        notif.alertBody = [NSString stringWithFormat:@"@%@ said: \"%@\"", userName, msgText];
    } else if (notificationType == 2) { // image
        notif.alertBody = [NSString stringWithFormat:@"@%@ sent an image", userName];
    } else {

    if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateActive) {
        [[UIApplication sharedApplication] presentLocalNotificationNow:notif];

Update: It now seems that the problem is that the connection to the server is being "paused" while the app is in the background. Once I then open the app all the data comes in at once. I am using SocketRocket for connecting to my Node.js Primus web socket server. Is this something that normally happens? This is my first time using SocketRocket so I'm not sure.

Update: I have also enabled Remote Notifications for Background Modes, I have also registered for remote notifications, and on the device, I have also made sure that "banners" and "badges" are enabled.

Update: I have additionally set the web socket to use a background queue.

[webSocket setDelegateOperationQueue:[NSOperationQueue new]];

The connection is still being paused.


Source: (StackOverflow)

.framework product is red no matter what

I'm trying to add this framework to a project. I have followed these instructions to the letter:

  1. Add SocketRocket.xcodeproj as either a subproject of your app or in your workspace.
  2. Add SocketRocket.framework to the link libraries
  3. If you don't have a "copy files" step for Framework, create one
  4. Add SocketRocket.framework to the "copy files" step.

I made sure I had only one instance of xcode open, then dragged the SocketRocket.xcodeproj file into my project. I added the .framework file to the link libraries, created a copy files build phase, then added the .framework to the copy files build phase.

This is the error I get when I try to build:

clang: error: no such file or directory: '/Users/adamhickey/Library/Developer/Xcode/DerivedData/websockettest-fcuhfltporfkitgubwcjukxogzas/Build/Products/Debug-iphonesimulator/SocketRocket/SocketRocket'

It's quite right: that directory does not exist.

In build phases, the SocketRocket.framework is red under Link Binary With Libraries. It's also red in the products folder of the SocketRocket subproject.

I've been googling this error for hours and the majority of the things I've tried have pointed me towards changing the build location in Xcode->preferences-locations. I've tried:

  1. setting it to relative, picking my own, and going to advanced and choosing legacy.
  2. building for a device
  3. build for->archiving
  4. building for release

If I open the SocketRocket.xcodeproj in a separate instance of xcode and try to build it, 3 of the four products are red. The products are: libSocketRocket.a, SRWebSocketTests.octest,, and SocketRocket.framework. The first is white, while the last three are red.

I'm assuming that if I can get the .framework file to build in a separate project, this will solve my overall problem. However, nothing I do seems to have any effect.

Please please please help! I'm using xcode 4.6.

Source: (StackOverflow)

Error in opening .xcworkspace

I integrated pods in my project specifically SignalR, AFNetworking and SocketRocket. It was successfully installed, but when I opened .xcworkspace, this error shows:

enter image description here

This is what the project navigator looks like

Has anyone encountered this kind of error? Thanks in advance.

Update: My .xcodeproj has appeared. But the frameworks appear red. How can I solve this?

enter image description here

Source: (StackOverflow)

Class is implemented in both. One of the two will be used

I have a project that has a dependency (installed via CocoaPods) using SocketRocket and have imported a static library from HeapAnalytics. Apparently the HeapAnalytics library already uses SocketRocket. I get no errors when compiling, but at runtime receive the following:

Class SRWebSocket is implemented in both [path] and [path].
One of the two will be used. Which one is undefined.

I'm not sure how to handle it because most solutions I've seen require compiling the static library yourself change class names and such, and I don't have access to the source.

Any recommendations?

Source: (StackOverflow)

iOS Client connecting to server using socketrocket results in "Stream end encountered"

NSString *urlString = @"ip address";
self.webSocket = [[SRWebSocket alloc] initWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]];
self.webSocket.delegate = self;
[self.webSocket open];

Here didCloseWithCode is called with reason Stream end encountered.

Any ideas about what might go wrong?

Source: (StackOverflow)

SocketRocket (iOS) : How to identify whom user are chatting with another?

I would like to create multiple sockets between all users. So how can i pass key and ID such as the server is divided in seprated windows.

Thank You.

Source: (StackOverflow)

iOS - Best solution for implementing websocket connection across the entire iOS app?

In my app, websocket connection and communication is in the certain ViewController but later came request to receive messages through websocket across the entire app.

What would be the best way to do it? To move the websocket code to AppDelegate or to create super ViewController? Or something else and better?

Source: (StackOverflow)

Is there a fork of SocketRocket that is more stable or actively developed?

I've been using SocketRocket for a few projects and have noticed that SocketRocket has quite a few unresolved issues and is buggy. I have personally patched a few crashes that I have experienced.

Square does not appear to have been maintaining SocketRocket over the past year. Is there another fork of their repo that is considered to be more stable/authoritative?

I would even be willing to consider an alternate library, maybe even one that's written in C/C++ if it can play nice with ObjC coding patterns.

Source: (StackOverflow)