A conforming Objective-C WebSocket client library.

SocketRocket After trying to install socketrocket so that I can make PonyDebugger work, I'm getting 3 Apple Match-O linker errors

I'm getting the fllowing. It's my first time trying to install this and I have to since I need the Pony Debugger working.

Undefined symbols for architecture i386:
  "_utf8_countTrailBytes", referenced from:
      _validate_dispatch_data_partial_string in libSocketRocket.a(SRWebSocket.o)
  "_utf8_nextCharSafeBody", referenced from:
      _validate_dispatch_data_partial_string in libSocketRocket.a(SRWebSocket.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any advice is very much appreciated!


EDIT: I added the SocketRocket.Framework to the build Phases and the errors are gone but is now giving me a new one.


The new one doesn't make sense at all.

Source: (StackOverflow)

iOS Rocket socket with ip address not working

I want to make the socket rocket work with ip address instead of host name

I am using Socket Rocket Visit https://github.com/square/SocketRocket#readme to create real time application on iPhone/ipad ,the library works fine if i use host name , but it doesn't work if i use ip address instead of host name (i get the ip by ping my web server host name)

Tried to resolve ip address to its host name but nothing.

Source: (StackOverflow)

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)

clients for signalR in native ios and android

1) If I have to develop native IOS client for a server that uses SignalR can I use

SocketRocket or UnittWebSocketClient ?

2) The client App does not use any browser will that matter ?

3) How is SignalR Different from Superwebsocket or microsoft's websocket available in .net 4.5? Dont all of them support rfc6455 protocol ?

Source: (StackOverflow)

SocketRocket not working on iOS 5.0

I just made a simple real-time text chat application using SocketRocket. It works great on iOS 6.0 and 5.1 but when I try to run it on 5.0 when connecting I get the following error...

Websocket Failed With Error Error Domain=NSOSStatusErrorDomain Code=-9800 "The
operation couldn’t be completed. (OSStatus error -9800.)"
UserInfo=0x6e506e0 {}

Does anyone have any idea what this could mean or how to fix it? I browsed the issues on github but couldnt find anything and its claimed to work on iOS5+.

EDIT: To add, this is when I test on simulator. I dont have a device that has 5.0, so im not sure if fails on the phone in the same way. Also, if I use ws as opposed to wss (encrypted), it seems to work fine.

Source: (StackOverflow)

WebSocket Connection is not closing using SocketRocket

I use the SocketRocket library for Objective-C to connect to a websocket:

-(void)open {

if( self.webSocket ) {
    [self.webSocket close];
    self.webSocket.delegate = nil;

self.webSocket = [[SRWebSocket alloc] initWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"ws://"] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20]];
self.webSocket.delegate = self;
[self.webSocket open];

Opening the connection works totally fine. The delegate is called after the connection was established.

-(void)webSocketDidOpen:(SRWebSocket *)webSocket {

NSLog(@"WebSocket is open");


But when I want to close the connection, nothing happens.

-(void)close {

if( !self.webSocket )

[self.webSocket close];
self.webSocket.delegate = nil;


The delegate for successfully closing the connection is not called. Can anyone tell me why this happens?

Thank you for reading my question.

Source: (StackOverflow)

Domain=NSPOSIXErrorDomain Code=61

I'm trying to connect between the client(iOS app) and the server(Node.js) with using SocketRocket and ws like this below.


NSURL *url = [NSURL urlWithString:@"ws://localhost:8080"];
SRWebSocket *_socket = [SRWebSocket alloc] initWithURLRequest:[NSURLRequest requestWithURL:url];
_socket.delegate = self;
[_socket open];

/* SRWebSocketDelegate */
    [webSocket send:@"something"];
-(void)webSocket:(SRWebSocket*)webSocket didReceiveMessage:(id)message{
    NSLog(@"didReceiveMessage: %@",[message description]);
-(void)webSocket:(SRWebSocket*)webSocket didFailWithError:(NSError*)error{
    NSLog(@"the Error: %@",error);


var WebSocketServer = require('ws').Server
var wss = new WebSocketServer({
        console.log('received: %s', message);

Then, I got the message this below:

the error: Error Domain=NSPOSIXErrorDomain Code=61 "The operation couldn’t be completed. Connection refused"

I've searched to solve this, but I couldn't find the exactly solution for this. How do I solve this??

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)

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)

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 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)

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)

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)

.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, TestChat.app, 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)

iOS Client connecting to NodeJS socket.io results in Stream end encountered

I have a NodeJS server that uses socket.io and listen to port 8000. The code is something like this:

var io = require("socket.io");
var socket = io.listen(8000);
socket.sockets.on("connection", function(client) {
    util.log("Client connects: " + client.id);

I have written a web client that can connects to this server and it works just fine. So the server code is not the problem. The problem is with the iOS client that I am about to describe next.

The iOS client uses SocketRocket and to install it, I use Cocoapods and have a Podfile with the following:

platform :ios
pod 'SocketRocket', '0.2.0'

In MyViewController.h

#import <SocketRocket/SRWebSocket.h>

@interface MyViewController : UIViewController<SRWebSocketDelegate> 
    @property (strong, nonatomic) SRWebSocket *socket;

In MyViewController.m

@synthesize socket = _socket;

- (void)viewDidLoad
    _socket = [[SRWebSocket alloc] initWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@""]]];
    _socket.delegate = self;

    [_socket open];


- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message {
    NSLog(@"Error didReceiveMessage");

- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error {
    NSLog(@"Error connecting websocket");

- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean {
    NSLog(@"Error didCloseWithCode %d: %@", code, reason);

When the iOS client runs, the log "Connect" shows up. But the delegate didCloseWithCode() also gets invoked. And the log shows

Error didCloseWithCode 0: Stream end encountered

I have spent lots of time trying to figure out, but it's time to get some help from experts. Why am I getting the "Stream end" problem. The NodeJS server is working just fine, since I can connect to it with a web client. What am I doing wrong with the iOS client and how can I correct?

Update: Add JavaScript code on the server to show the util.log() call. When the web client connects, console shows "Client connects"..." message. When the iOS client attempts to connect, nothing on the console.

Source: (StackOverflow)