Socket.IO-Client-Swift icon indicating copy to clipboard operation
Socket.IO-Client-Swift copied to clipboard

get status of Socket Connection in Objective-c

Open mostafatabal opened this issue 8 years ago • 6 comments

@nuclearace All Docs in swift and i couldn't find in objective-c , please help

How check if socket connected or not and get status of socket connection and the emitting fails because not connected .. please give me code by Objective-c

mostafatabal avatar Jan 19 '18 18:01 mostafatabal

You can translate Swift -> Objective-C nearly 1:1, it's not that different.

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

nuclearace avatar Jan 19 '18 19:01 nuclearace

@nuclearace the connection take more time and not connect , what can i do but i see in command line in server said connected, what is the problem ?

mostafatabal avatar Jan 19 '18 19:01 mostafatabal

Again, if you look at the docs and the readme. You'll see how to enable logging. I'm don't have the time to translate everything to Objective-C.

nuclearace avatar Jan 19 '18 19:01 nuclearace

i can do logging by adding @"log" : @YES but the log give me when try emit not connected and if call url in browser give me socket id that tell me i connected and this the response from server ..

mostafatabal avatar Jan 19 '18 19:01 mostafatabal

@nuclearace

mostafatabal avatar Jan 19 '18 19:01 mostafatabal

Well:

  1. Learn to translate Swift -> Objective-C and use the docs. It's not hard.
  2. You have to emit after connecting.
  3. If you aren't connecting then you need to look at the logs and find out why it's not connecting.

nuclearace avatar Jan 19 '18 19:01 nuclearace