Giter Site home page Giter Site logo

vpsocketio's Introduction

VPSocketIO

Socket.IO client for iOS. Supports socket.io 2.0+

It's based on a official Swift library from here: SocketIO-Client-Swift

It uses Jetfire Jetfire

Objective-C Example

#import <SocketIO-iOS/SocketIO-iOS.h>;
NSURL* url = [[NSURL alloc] initWithString:@"http://localhost:8080"];
SocketIOClient* socket = [[SocketIOClient alloc] initWithSocketURL:url config:@{@"log": @YES];

[socket on:@"connect" callback:^(NSArray* data, SocketAckEmitter* ack) {
    NSLog(@"socket connected");
}];

[socket connect];

Features

  • Supports socket.io 2.0+
  • Supports binary
  • Supports Polling and WebSockets
  • Supports TLS/SSL

Installation

Carthage

Add these line to your Cartfile:

github "vascome/vpsocketio" ~> 1.0.5 # Or latest version

Run carthage update --platform ios,macosx.

CocoaPods 1.0.0 or later

Create Podfile and add pod 'VPSocketIO' (pod files are case sensetive):

target 'MyApp' do
    pod 'VPSocketIO', '~> 1.0.5' # Or latest version
end

License

MIT

vpsocketio's People

Contributors

vasily-popov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vpsocketio's Issues

A few too many non-error errors?

When testing on iOS with Developer -> Network Link Conditioner set to Very Bad Network, I see lots of these:

ERROR: Engine tried opening while connected. Assuming this was a reconnect

Maybe the server should know and not assume when it is a reconnect? In any case should it really be type ERROR?

Also lots of these:

SocketEngine ERROR: The operation couldn’t be completed. (JFRWebSocket error 1000.)

Which also don't look like errors.

Here is my config:

[[self alloc] initWithURL:[NSURL URLWithString:@"https://ws.blah.me"] options:@{@"secure": @YES, @"forceNew": @NO, @"forceWebsockets": @NO, @"forcePolling": @NO, @"reconnectWait": @30, @"logger":logger, @"log": @NO}];

We're connecting with:

self.defaultTimeout = 30;
[self.socket connectWithTimeoutAfter:self.defaultTimeout withHandler:^{
}];

CFNetwork SSLHandshake failed

CFNetwork SSLHandshake failed (-9806)
TCP Conn 0x600000165040 SSLHandshake failed (-9806)
SocketStream write error [0x600000165040]: 3 -9806
ClientSocket MESSAGE: Flushing probe wait

emitWithAck and timingOutAfter not working.

I can emit a message with args and it just sends fine:

[client emit:@"message" items:@[data]];

However, I need the ACK payload too, so I use:

[[client emit:@"message" items:@[data]] timingOutAfter:5 callback:^(NSArray *array) {
    //process response
}];

Though, neither my message is sent to the server, nor I receive a response/ACK.

What am I doing wrong? (my server is on socket.io 2.0)

deadlocks

We are seeing the occasional deadlock when developing. The only active thread is VPSocketIO stuff.

screen shot 2017-12-21 at 5 37 10 pm

Any ideas how we could help debug this?

Can't get ssid

url = [[NSURL alloc] initWithString:@"http://localhost:3000"];

socket = [[VPSocketIOClient alloc] init:url withConfig:@{@"log": @false}];

[socket on:@"connect" callback:^(NSArray* data, VPSocketAckEmitter* ack) {
NSLog(@"socket connected: %@", [self->socket ssid]);
}];

But Log window show: socket connected: (null)
And urlRequest show: "<CFHTTPMessageRef 0x28365d5c0(0x28365d5d0)> { GET request, url ws://localhost:3000/socket.io/?transport=websocket&sid=vEquHExR-HYULOyPAAAE }"

CocoaPods can't find pod 'vpsocketio'

Before you ask, yes, I did pod update

In my podfile I have (with 20+ other perfectly working pods):
pod 'vpsocketio'

Though it says:

[!] Unable to find a specification for vpsocketio

'VPSocketPacket.h' file not found

I'm using it inside a framework with Objective-C.
After 'pod install', I build the framework and get 'VPSocketPacket.h' file not found, and it actually isn't there.
Then I have to 'pod install' again until the error is gone, but again after I change some pod and install I'm getting it again.
Am I missing something?

Namespace usage

I'm having trouble emitting messages (and getting responses) to a separate namespace.

I created two clients:

  1. no namespace specified
  2. namespace specified to be "/chat"

The url's for both are the same. The messages to 1 are working fine but not 2. Any ideas? Has the namespace stuff been extensively used?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.