nuclearace / Socket.IO-Client-Swift

socket.io-client for Swift
Other
361 stars 53 forks source link

get status of Socket Connection in Objective-c #157

Open mostafatabal opened 6 years ago

mostafatabal commented 6 years ago

@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

nuclearace commented 6 years ago

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");
}];
mostafatabal commented 6 years ago

@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 ?

nuclearace commented 6 years ago

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.

mostafatabal commented 6 years ago

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 commented 6 years ago

@nuclearace

nuclearace commented 6 years ago

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.