Coder Social home page Coder Social logo

socketiococoa's Introduction

SocketIOCocoa

The socket 1.0 client in Swift. It includes xhr polling and websocket transports.

This is a port from socketio.client, which means the code structure are quite similar.

Motivation & Contribute

For our startup project, we running socketio1.0 in our server, and needs an iOS client. I tried my best to find the iOS client, but with no luck.

I am still dogfooding it, any issue report, pull request are welcomed.

Installation

Untill CocoaPod's swift library support story completes, it is much easier just copy all files and put them in your project. The framework way is troublesome and I won't bother to mark them down here.

Files needs to copied:

All swift files under Vender

All swift files under SocketIOCocoa

Usage

Swift

Create a client

var client = SocketIOClient(uri: uri, reconnect: true, timeout: 30)
client.open()

Create a socket

var socket = client.socket("namespace")
// Set a delegate on socket

The SocketIOSocketDelegate

@objc public protocol SocketIOSocketDelegate {
    // Called when the socket received a low level packet
    optional func socketOnPacket(socket: SocketIOSocket, packet: SocketIOPacket)
    
    // Called when the socket received an event
    func socketOnEvent(socket: SocketIOSocket, event: String, data: AnyObject?)
    
    // Called when the socket is open
    func socketOnOpen(socket: SocketIOSocket)
    
    // Called when the socket is on error
    func socketOnError(socket: SocketIOSocket, error: String, description: String?)
}

Send message to server, when a callback provides, it will require an ACK or BinaryACK from server, then the callback will be called.

socket.event("message", data: [1,2,3]) { (packet) -> Void in
    expectation.fulfill()
}
self.waitForExpectationsWithTimeout(300, handler: nil)

ObjC

Create a client

self.client = [[SocketIOClient alloc] initWithUri: @"http://<server ip>/socket.io/" transports:@[@"polling", @"websocket"] autoConnect:YES reconnect:YES reconnectAttempts:0 reconnectDelay:5 reconnectDelayMax:30 timeout:30];
[self.client open];

Create a socket

self.apiSocket = [self.client socket:@"namespace"];
self.apiSocket.delegate = self;

The SocketIOSocketDelegate

Socket received event with data

- (void)socketOnEvent:(SocketIOSocket *)socket event:(NSString *)event data:(id)data

Socket on open

- (void)socketOnOpen:(SocketIOSocket *)socket{

Socket on error, description is a detailed message for the error

- (void)socketOnError:(SocketIOSocket *)socket error:(NSString *)error description:(NSString *)description

Socket on packet, lower level packet, used to tracking socket activity.

- (void)socketOnPacket:(SocketIOSocket *)socket packet:(SocketIOPacket *)packet;

Under the hood

Alamofire for xhr polling, starscream for websocket. GCD for async tasks.

TODO

Performance enhaucement

LICENSE

MIT

CREDIT

socketiococoa's People

Contributors

shuoli84 avatar thebehera avatar

Stargazers

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

socketiococoa's Issues

EXC_BREAKPOINT

I am getting an EXC_BREAKPOINT on this line

screen shot 2015-02-19 at 16 28 59

I am using socket.io v1.3.4, and engine.io v1.5.1, and SocketIOCocoa from master. On the server my code looks like this:

var socketio = require('socket.io'),
  io = socketio(server);

io.of('/brand/root').on('connection', function(socket) {

    var interval = setInterval(function() {
        console.log('sending foo');
        socket.emit('foo', {bar: 'baz'});
    }, 40*1000);

    socket.on('disconnect', function() {
        console.log('socket disconnected');
        clearInterval(interval);
    });

    socket.on('test', function(data, fn) {
        console.log('server got test event', data);
        fn('ack from server');
    });

    socket.emit('test', {server: 'from on.connection'}, function(data) {
        console.log('got ack from client', data);
    });
});

And on the client:

import Foundation

@objc class Sockets : NSObject, SocketIOSocketDelegate {

    func start() {
        var client = SocketIOClient(uri: "http://localhost:3000/socket.io/", reconnect: true, timeout: 30, transports: ["websocket"])
        client.open()
        var socket = client.socket("/brand/root")
        socket.delegate = self
    }

    func socketOnEvent(socket: SocketIOSocket, event: String, data: AnyObject?){
        println("got event \(event) \(data)")
    }

    func socketOnPacket(socket: SocketIOSocket, packet: SocketIOPacket) {
        println("socket packet \(packet.data))")
    }

    func socketOnOpen(socket: SocketIOSocket) {
        println("socket open")
        socket.event("test", data: [1, 2, 3]) { (packet) -> Void in
            println("got ack from server \(packet.data)")
        }
    }

    func socketOnError(socket: SocketIOSocket, error: String, description: String?) {
        println("socket error \(error)")
    }
}

background mode

Thank you for such great library.
I wonder if it can work in background mode.
I was playing around background mode and it works only in simulator. It doesn't work at real device. What do I do wrong?

After long connection, it fails without clientOnClose callback

I have long connection with server, and I see logs:

[EngineSocket(Optional("qZixT-p7qaxD3Uz4AACS"))][Open][Upg:0][TW:1] Sending Ping
[EngineSocket(Optional("qZixT-p7qaxD3Uz4AACS"))][Open][Upg:0][TW:1] Setting up ping and reset timeout
[EngineSocket(Optional("qZixT-p7qaxD3Uz4AACS"))][Open][Upg:0][TW:1] Enqueue packet
[EngineSocket(Optional("qZixT-p7qaxD3Uz4AACS"))][Open][Upg:0][TW:1] Flushing 1 packets
[WebsocketTransport][Open] Received text message 3

But when I have lost connection, I didn't receive "Received text message 3" any more and clientOnClose delegate didn't call

Bugs when Alamofire and Starscream are already imported as projects

Hi,
I have kind of the same issue like the other guy that posted about Alamofire.

I already use it for a lot of REST calls and it wont find the methods anymore when I import your vendor folder. It somehow only checks for your alamofire.swift and doesnt accept calls for the natively imported project file.

join/emit to rooms?

is there a possibility to join rooms or to send messages/events to rooms? your documentation only says namespaces

€dit:
additionally how do you correctly utilize the protocol to open a socket in main viewcontroller and catch events on a second view controller without opening another socket/client?

Client connects, socket.event(...) seems to not fire, no delegate methods called

override func viewDidLoad() {
    client = SocketIOClient(uri: "http://localhost:3000/socket.io/",  reconnect: true, timeout: 30)
    client.delegate = self
    client.open()
    socket = client.socket("")
    socket.event("add user", data: "Apple iPhone", ack: ack)
    socket.delegate = self
    socket.open()
}

// delegate methods
func socketOnEvent(socket: SocketIOSocket, event: String, data: AnyObject?) {
    println("socket event -> \(event): \(data)")
}

func socketOnOpen(socket: SocketIOSocket) {
    println("socket open \(socket.description)")
}

func socketOnError(socket: SocketIOSocket, error: String, description: String?) {
    println("socket error: \(error)")
}

2015-02-19 12:52:04.895 socket.io[92348:5929284] [SocketIOClient] ready state: Closed
2015-02-19 12:52:04.896 socket.io[92348:5929284] [SocketIOClient] Opening
2015-02-19 12:52:04.896 socket.io[92348:5929284] connect attempt will timeout after 30 seconds
2015-02-19 12:52:04.896 socket.io[92348:5929284] [SocketIOClient] ready state: Opening
2015-02-19 12:52:04.898 socket.io[92348:5929390] [D][PollingTransport][Opening] polling http://localhost:3000/socket.io/?transport=polling&t=1424368324&EIO=3
2015-02-19 12:52:04.931 socket.io[92348:5929391] [D][PollingTransport][Opening] Request succeeded
2015-02-19 12:52:04.932 socket.io[92348:5929391] [D][PollingTransport][Opening] polling got data [0, 9, 7, 255, 48, 123, 34, 115, 105, 100, 34, 58, 34, 71, 79, 99, 102, 83, 95, 90, 116, 106, 108, 54, 106, 121, 71, 56, 53, 65, 65, 65, 78, 34, 44, 34, 117, 112, 103, 114, 97, 100, 101, 115, 34, 58, 91, 34, 119, 101, 98, 115, 111, 99, 107, 101, 116, 34, 93, 44, 34, 112, 105, 110, 103, 73, 110, 116, 101, 114, 118, 97, 108, 34, 58, 50, 53, 48, 48, 48, 44, 34, 112, 105, 110, 103, 84, 105, 109, 101, 111, 117, 116, 34, 58, 54, 48, 48, 48, 48, 125]
2015-02-19 12:52:04.932 socket.io[92348:5929391] [D][PollingTransport][Opening] Polling got data back, set state to Open
2015-02-19 12:52:04.932 socket.io[92348:5929391] [I][EngineSocket(nil)][Opening][Upg:0][TW:1] Receive: [[Open][Binary: false]: {"sid":"GOcfS_Ztjl6jyG85AAAN","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}]
2015-02-19 12:52:04.933 socket.io[92348:5929391] [D][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Opening][Upg:0][TW:1] Socket Open
2015-02-19 12:52:04.989 socket.io[92348:5929390] [SocketIOClient][Open Underlying engine socket connected
2015-02-19 12:52:04.989 socket.io[92348:5929391] [D][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:0][TW:1] The writeQueue is empty, return
client connected
2015-02-19 12:52:04.989 socket.io[92348:5929391] [D][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:0][TW:1] Start upgrading
2015-02-19 12:52:04.989 socket.io[92348:5929390] [SocketIOSocket][/][U] connect to namespace
2015-02-19 12:52:04.989 socket.io[92348:5929391] [D][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:0][TW:1] probing: websocket
2015-02-19 12:52:04.990 socket.io[92348:5929390] [SocketIOClient][Open] Sending packet [Connect][NS:Optional("/")][DATA]
2015-02-19 12:52:04.990 socket.io[92348:5929391] [D][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:0][TW:1] Setting up ping and reset timeout
2015-02-19 12:52:04.990 socket.io[92348:5929391] [D][PollingTransport][Open] polling
2015-02-19 12:52:04.991 socket.io[92348:5929391] [D][WebsocketTransport][Opening] Connecting ws://localhost:3000/socket.io/?transport=websocket&t=1424368324&EIO=3&sid=GOcfS_Ztjl6jyG85AAAN
2015-02-19 12:52:04.991 socket.io[92348:5929391] [D][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:0][TW:1] Enqueue packet
2015-02-19 12:52:04.991 socket.io[92348:5929391] [D][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:0][TW:1] Flushing 1 packets
2015-02-19 12:52:04.991 socket.io[92348:5929391] [D][PollingTransport][Open] Send 1 packets out
2015-02-19 12:52:04.994 socket.io[92348:5929391] [D][PollingTransport][Open] polling http://localhost:3000/socket.io/?transport=polling&t=1424368324&EIO=3&sid=GOcfS_Ztjl6jyG85AAAN
2015-02-19 12:52:04.994 socket.io[92348:5929391] [D][WebsocketTransport][Opening] Websocket transport connected
2015-02-19 12:52:05.070 socket.io[92348:5929391] [D][ProbeTransportDelegate][Failed:false] Probing websocket
2015-02-19 12:52:05.070 socket.io[92348:5929391] [D][PollingTransport][Open] Request send to server succeeded
2015-02-19 12:52:05.070 socket.io[92348:5929391] [D][PollingTransport][Open] Request succeeded
2015-02-19 12:52:05.071 socket.io[92348:5929391] [D][PollingTransport][Open] polling got data [0, 2, 255, 52, 48, 0, 2, 255, 52, 48]
2015-02-19 12:52:05.071 socket.io[92348:5929391] [I][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:0][TW:1] Receive: [[Message][Binary: false]: 0]
2015-02-19 12:52:05.072 socket.io[92348:5929391] [SocketIOClient][Open] got packet from underlying socket
2015-02-19 12:52:05.072 socket.io[92348:5929391] [I][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:0][TW:1] Receive: [[Message][Binary: false]: 0]
2015-02-19 12:52:05.072 socket.io[92348:5929391] [SocketIOClient][Open] got packet from underlying socket
2015-02-19 12:52:05.072 socket.io[92348:5929391] [D][PollingTransport][Open] polling
2015-02-19 12:52:05.074 socket.io[92348:5929391] [D][PollingTransport][Open] polling http://localhost:3000/socket.io/?transport=polling&t=1424368325&EIO=3&sid=GOcfS_Ztjl6jyG85AAAN
2015-02-19 12:52:05.074 socket.io[92348:5929391] [D][WebsocketTransport][Open] Received text message 3probe
2015-02-19 12:52:05.074 socket.io[92348:5929391] [D][ProbeTransportDelegate][Failed:false] Probe transport pong
2015-02-19 12:52:05.074 socket.io[92348:5929391] [D][ProbeTransportDelegate][Failed:false] Pause current transport
2015-02-19 12:52:05.075 socket.io[92348:5929391] [D][PollingTransport][Open] Pausing
2015-02-19 12:52:05.075 socket.io[92348:5929391] [D][PollingTransport][Pausing] The transport still polling or writing, postpone the pause action
2015-02-19 12:52:05.174 socket.io[92348:5929401] [D][PollingTransport][Pausing] Request succeeded
2015-02-19 12:52:05.175 socket.io[92348:5929401] [D][PollingTransport][Pausing] polling got data [0, 1, 255, 54]
2015-02-19 12:52:05.175 socket.io[92348:5929401] [I][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:1][TW:1] Receive: [[Noop][Binary: false]: nil]
2015-02-19 12:52:05.175 socket.io[92348:5929401] [D][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:1][TW:1] HITTING DEFAULT CLAUSE, CAREFUL
2015-02-19 12:52:05.176 socket.io[92348:5929401] [D][PollingTransport][Pausing] Paused
2015-02-19 12:52:05.176 socket.io[92348:5929401] [D][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:1][TW:1] Transport [polling] Paused
2015-02-19 12:52:05.176 socket.io[92348:5929401] [D][ProbeTransportDelegate][Failed:false] Prev transport paused
2015-02-19 12:52:05.176 socket.io[92348:5929401] [D][ProbeTransportDelegate][Failed:false] Changing transport and sending upgrade packet
2015-02-19 12:52:05.176 socket.io[92348:5929401] Underlying socket upgraded
2015-02-19 12:52:05.177 socket.io[92348:5929401] [D][EngineSocket(Optional("GOcfS_Ztjl6jyG85AAAN"))][Open][Upg:0][TW:1] The writeQueue is empty, return

One event fired several times

When there are several messages embed in one payload, the event fired several times. It turns out a stupid for packet { xxxxx for packet {} } issue.

Double connection

When I try to connect to my server via SocketIOClient I’m getting two connections and then when I’m trying to send something, my emit duplicates.
First of all I open a client and then I open a socket delegated to client
code example:

private struct kSocketHandler
{
    var socket: SocketIOSocket
    var handlers: NSMutableArray
    // events
    var eventSheet: kSocketEventSheet?

    init(Socket s: SocketIOSocket)
    {
        socket = s
        handlers = NSMutableArray()
    }

    ....

}

....

internal class kSocketManager: SocketIOClientDelegate, SocketIOSocketDelegate

....

var client: SocketIOClient

private var sockets: [kSocketHandler]

....

// initilization
client = SocketIOClient(uri: u, transports: ["websocket"], autoConnect: false, reconnect: false, reconnectAttempts: 0, reconnectDelay: 5, reconnectDelayMax: 10, timeout: 7)
client.delegate = self

....

// initialization of the socket (with a small wrapper)
var newSocket = kSocketHandler(Socket: self.client.socket(namespace))

newSocket.socket.delegate = self
newSocket.eventSheet = socketEventSheet
newSocket.socket.open()

self.sockets.append(newSocket)

So, I receive «OnSocketOpen» event twice every time i try to run this code.

Any suggestions?
Sincerely yours.

d connection

crashing in decodePayload()

2015-02-18 22:11:52.133 socket.io[88235:5778748] [D][PollingTransport][Opening] Request succeeded
2015-02-18 22:11:52.138 socket.io[88235:5778748] [D][PollingTransport][Opening] polling got data [60, 33, 100, 111, 99, 116, 121, 112, 101, 32, 104, 116, 109, 108, 62, 10, 60, 104, 116, 109, 108, 62, 10, 32, 32, 60, 104, 101, 97, 100, 62, 10, 32, 32, 32, 32, 60, 116, 105, 116, 108, 101, 62, 83, 111, 99, 107, 101, 116, 46, 73, 79, 32, 99, 104, 97, 116, 60, 47, 116, 105, 116, 108, 101, 62, 10, 32, 32, 32, 32, 60, 115, 116, 121, 108, 101, 62, 10, 32, 32, 32, 32, 32, 32, 42, 32, 123, 32, 109, 97, 114, 103, 105, 110, 58, 32, 48, 59, 32, 112, 97, 100, 100, 105, 110, 103, 58, 32, 48, 59, 32, 98, 111, 120, 45, 115, 105, 122, 105, 110, 103, 58, 32, 98, 111, 114, 100, 101, 114, 45, 98, 111, 120, 59, 32, 125, 10, 32, 32, 32, 32, 32, 32, 98, 111, 100, 121, 32, 123, 32, 102, 111, 110, 116, 58, 32, 49, 51, 112, 120, 32, 72, 101, 108, 118, 101, 116, 105, 99, 97, 44, 32, 65, 114, 105, 97, 108, 59, 32, 125, 10, 32, 32, 32, 32, 32, 32, 102, 111, 114, 109, 32, 123, 32, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 58, 32, 35, 48, 48, 48, 59, 32, 112, 97, 100, 100, 105, 110, 103, 58, 32, 51, 112, 120, 59, 32, 112, 111, 115, 105, 116, 105, 111, 110, 58, 32, 102, 105, 120, 101, 100, 59, 32, 98, 111, 116, 116, 111, 109, 58, 32, 48, 59, 32, 119, 105, 100, 116, 104, 58, 32, 49, 48, 48, 37, 59, 32, 125, 10, 32, 32, 32, 32, 32, 32, 102, 111, 114, 109, 32, 105, 110, 112, 117, 116, 32, 123, 32, 98, 111, 114, 100, 101, 114, 58, 32, 48, 59, 32, 112, 97, 100, 100, 105, 110, 103, 58, 32, 49, 48, 112, 120, 59, 32, 119, 105, 100, 116, 104, 58, 32, 57, 48, 37, 59, 32, 109, 97, 114, 103, 105, 110, 45, 114, 105, 103, 104, 116, 58, 32, 46, 53, 37, 59, 32, 125, 10, 32, 32, 32, 32, 32, 32, 102, 111, 114, 109, 32, 98, 117, 116, 116, 111, 110, 32, 123, 32, 119, 105, 100, 116, 104, 58, 32, 57, 37, 59, 32, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 58, 32, 114, 103, 98, 40, 49, 51, 48, 44, 32, 50, 50, 52, 44, 32, 50, 53, 53, 41, 59, 32, 98, 111, 114, 100, 101, 114, 58, 32, 110, 111, 110, 101, 59, 32, 112, 97, 100, 100, 105, 110, 103, 58, 32, 49, 48, 112, 120, 59, 32, 125, 10, 32, 32, 32, 32, 32, 32, 35, 109, 101, 115, 115, 97, 103, 101, 115, 32, 123, 32, 108, 105, 115, 116, 45, 115, 116, 121, 108, 101, 45, 116, 121, 112, 101, 58, 32, 110, 111, 110, 101, 59, 32, 109, 97, 114, 103, 105, 110, 58, 32, 48, 59, 32, 112, 97, 100, 100, 105, 110, 103, 58, 32, 48, 59, 32, 125, 10, 32, 32, 32, 32, 32, 32, 35, 109, 101, 115, 115, 97, 103, 101, 115, 32, 108, 105, 32, 123, 32, 112, 97, 100, 100, 105, 110, 103, 58, 32, 53, 112, 120, 32, 49, 48, 112, 120, 59, 32, 125, 10, 32, 32, 32, 32, 32, 32, 35, 109, 101, 115, 115, 97, 103, 101, 115, 32, 108, 105, 58, 110, 116, 104, 45, 99, 104, 105, 108, 100, 40, 111, 100, 100, 41, 32, 123, 32, 98, 97, 99, 107, 103, 114, 111, 117, 110, 100, 58, 32, 35, 101, 101, 101, 59, 32, 125, 10, 32, 32, 32, 32, 60, 47, 115, 116, 121, 108, 101, 62, 10, 32, 32, 60, 47, 104, 101, 97, 100, 62, 10, 32, 32, 60, 98, 111, 100, 121, 62, 10, 32, 32, 32, 32, 60, 117, 108, 32, 105, 100, 61, 34, 109, 101, 115, 115, 97, 103, 101, 115, 34, 62, 60, 47, 117, 108, 62, 10, 32, 32, 32, 32, 60, 102, 111, 114, 109, 32, 97, 99, 116, 105, 111, 110, 61, 34, 34, 62, 10, 32, 32, 32, 32, 32, 32, 60, 105, 110, 112, 117, 116, 32, 105, 100, 61, 34, 109, 34, 32, 97, 117, 116, 111, 99, 111, 109, 112, 108, 101, 116, 101, 61, 34, 111, 102, 102, 34, 32, 47, 62, 60, 98, 117, 116, 116, 111, 110, 62, 83, 101, 110, 100, 60, 47, 98, 117, 116, 116, 111, 110, 62, 10, 32, 32, 32, 32, 60, 47, 102, 111, 114, 109, 62, 10, 32, 32, 32, 32, 60, 115, 99, 114, 105, 112, 116, 32, 115, 114, 99, 61, 34, 47, 115, 111, 99, 107, 101, 116, 46, 105, 111, 47, 115, 111, 99, 107, 101, 116, 46, 105, 111, 46, 106, 115, 34, 62, 60, 47, 115, 99, 114, 105, 112, 116, 62, 10, 32, 32, 32, 32, 60, 115, 99, 114, 105, 112, 116, 32, 115, 114, 99, 61, 34, 104, 116, 116, 112, 58, 47, 47, 99, 111, 100, 101, 46, 106, 113, 117, 101, 114, 121, 46, 99, 111, 109, 47, 106, 113, 117, 101, 114, 121, 45, 49, 46, 49, 49, 46, 49, 46, 106, 115, 34, 62, 60, 47, 115, 99, 114, 105, 112, 116, 62, 10, 32, 32, 32, 32, 60, 115, 99, 114, 105, 112, 116, 62, 10, 32, 32, 32, 32, 32, 32, 118, 97, 114, 32, 115, 111, 99, 107, 101, 116, 32, 61, 32, 105, 111, 40, 41, 59, 10, 32, 32, 32, 32, 32, 32, 36, 40, 39, 102, 111, 114, 109, 39, 41, 46, 115, 117, 98, 109, 105, 116, 40, 102, 117, 110, 99, 116, 105, 111, 110, 40, 41, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 115, 111, 99, 107, 101, 116, 46, 101, 109, 105, 116, 40, 39, 99, 104, 97, 116, 39, 44, 32, 36, 40, 39, 35, 109, 39, 41, 46, 118, 97, 108, 40, 41, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 36, 40, 39, 35, 109, 39, 41, 46, 118, 97, 108, 40, 39, 39, 41, 59, 10, 32, 32, 32, 32, 32, 32, 32, 32, 114, 101, 116, 117, 114, 110, 32, 102, 97, 108, 115, 101, 59, 10, 32, 32, 32, 32, 32, 32, 125, 41, 59, 10, 32, 32, 32, 32, 32, 32, 115, 111, 99, 107, 101, 116, 46, 111, 110, 40, 39, 99, 104, 97, 116, 39, 44, 32, 102, 117, 110, 99, 116, 105, 111, 110, 40, 109, 115, 103, 41, 123, 10, 32, 32, 32, 32, 32, 32, 32, 32, 36, 40, 39, 35, 109, 101, 115, 115, 97, 103, 101, 115, 39, 41, 46, 97, 112, 112, 101, 110, 100, 40, 36, 40, 39, 60, 108, 105, 62, 39, 41, 46, 116, 101, 120, 116, 40, 109, 115, 103, 41, 41, 59, 10, 32, 32, 32, 32, 32, 32, 125, 41, 59, 10, 32, 32, 32, 32, 60, 47, 115, 99, 114, 105, 112, 116, 62, 10, 32, 32, 60, 47, 98, 111, 100, 121, 62, 10, 60, 47, 104, 116, 109, 108, 62, 10]

Socket is polling like crazy

when i open a new socket and join - suddenly the library starts polling like crazy - anyone else experienced this??

have the issue on both simulator and live device

2015-03-05 20:24:31.482 project[549:226571] [D][PollingTransport][Open] polling
2015-03-05 20:24:31.491 project[549:226571] [D][PollingTransport][Open] polling     http://xxx/socket.io/?sid=UnZHk6fMkXwmXRU8AAAa&EIO=3&t=1425583471&transport=polling
2015-03-05 20:24:31.526 project[549:226572] [D][PollingTransport][Open] polling
2015-03-05 20:24:31.536 project[549:226572] [D][PollingTransport][Open] polling  http://xxx/socket.io/?sid=UnZHk6fMkXwmXRU8AAAa&EIO=3&t=1425583471&transport=polling

and this goes on "forever" or until the server kicks me because of spam

SocketIOClient clean its state after close called

Regarding #13, the reason why the client not able to be reused is the blocks passed into the dispatch queue can't be cancelled. Which means after close() calls, the previous enqueued blocks can execute again, makes the whole instance in a messy state.

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.