smallseo.info

SocketRocket

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!

Thanks!

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

/Library/Developer/Xcode/DerivedData/ProjectIpaws-fxtqgpqcnolfqvgaeikbuxwzdbcv/Build/Products/Debug-iphonesimulator/SocketRocket/SocketRocket

The new one doesn't make sense at all.


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

link

My code


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;
@end

In MyViewController.m

@synthesize socket = _socket;
...

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

    [_socket open];

    NSLog(@"Connect");
}

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

Implementin SRWebSocketDelegate in Swift

I am implementing:

@protocol SRWebSocketDelegate <NSObject>

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

@optional

- (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)")
    self.connect(5.0)
}

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)

How to use SocketRocket with socket.io?

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 socket.io on node.js and prefer to try javascript. I tried connecting the SocketRocket TestChat simulator app to the node.js(6.10) socket.io(0.8.7) 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 socket.io server? Any sample code or suggestions are greatly appreciated.


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)

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.

iOS(SocketRocket):

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

/* SRWebSocketDelegate */
-(void)webSocketDidOpen:(SRWebSocket*)webSocket{
    [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);
}

Node.js(ws):

var WebSocketServer = require('ws').Server
var wss = new WebSocketServer({
    host:'localhost',
    port:8080
});
wss.on('connection',function(ws){
    ws.on('message',function(message){
        console.log('received: %s', message);
        ws.send(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)

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://192.168.0.254:5864"] 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 )
    return;

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