SocketIO客户端Swift库(版本13)未连接iOS

时间:2017-11-23 12:19:02

标签: ios swift sockets socket.io disconnect

在配置此库的过程时遇到此错误,我通过这样做来解决...

private lazy var logType = "SocketIOClient{(nsp)}"

早先是......

private lazy var logType = "SocketIOClient{\(nsp)}"

Got this error while configuring this library which I resolved by doing.."  "

使用下面的代码建立连接....虽然我能够连接到这个库的第10版。

后端团队说 - "套接字完美连接,几秒钟后它自动断开连接"

我还验证了手动断开代码的情况,但没有找到任何可能的方面......没有任何想法解决这个问题..需要帮助!!!

NSString *strToken = [[[NSUserDefaults standardUserDefaults] objectForKey:kUserDetailsFromPreferance] objectForKey:kAuth_Token];
SocketManager* manager = [[SocketManager alloc] initWithSocketURL:[NSURL URLWithString:[NSString stringWithFormat:kChatServer]]
                                                          config:@{@"log": @YES,@"connectParams": @{@"Authorization":strToken}}];
self.socket = manager.defaultSocket;
[self.socket connect];

我的控制台日志......

2017-11-23 17:51:32.986396+0530 [8044:2460214] Reachability Flag Status: -R ------- networkStatusForFlags
2017-11-23 17:51:32.989188+0530 [8044:2460214] Network Status =Reachable WiFi
2017-11-23 17:51:33.036545+0530 [8044:2460068] LOG SocketIOClient{(nsp)}: Handling event: statusChange with data: [connecting]
2017-11-23 17:51:33.036815+0530 [8044:2460068] LOG SocketManager: Tried connecting socket when engine isn't open. Connecting
2017-11-23 17:51:33.036879+0530 [8044:2460068] LOG SocketManager: Adding engine
2017-11-23 17:51:33.041499+0530 [8044:2460068] LOG SocketIOClient{(nsp)}: Adding handler for event: disconnect
2017-11-23 17:51:33.041600+0530 [8044:2460203] LOG SocketEngine: Starting engine. Server: http://192.168.0.107:3001/
2017-11-23 17:51:33.041667+0530 [8044:2460203] LOG SocketEngine: Handshaking
2017-11-23 17:51:33.041758+0530 [8044:2460068] LOG SocketIOClient{(nsp)}: Adding handler for event: connect
2017-11-23 17:51:33.041841+0530 [8044:2460068] LOG SocketIOClient{(nsp)}: Adding handler for event: incoming_message
2017-11-23 17:51:33.041910+0530 [8044:2460068] LOG SocketIOClient{(nsp)}: Adding handler for event: message_delivered
2017-11-23 17:51:33.041976+0530 [8044:2460068] LOG SocketIOClient{(nsp)}: Adding handler for event: chat receive_typing
2017-11-23 17:51:33.042037+0530 [8044:2460068] LOG SocketIOClient{(nsp)}: Adding handler for event: get_user_status
2017-11-23 17:51:33.042093+0530 [8044:2460068] LOG SocketIOClient{(nsp)}: Adding handler for event: scheduler receive_notification
2017-11-23 17:51:33.042196+0530 [8044:2460068] LOG SocketIOClient{(nsp)}: Adding handler for event: scheduler welcome_notification
2017-11-23 17:51:33.042252+0530 [8044:2460068] LOG SocketIOClient{(nsp)}: Adding handler for event: new_group_creation
2017-11-23 17:51:33.042312+0530 [8044:2460068] LOG SocketIOClient{(nsp)}: Adding handler for event: call receive_audio_video_call_status
2017-11-23 17:51:33.042366+0530 [8044:2460068] LOG SocketManager: Manager is being released
2017-11-23 17:51:33.043169+0530 [8044:2460203] LOG SocketEnginePolling: Doing polling GET http://192.168.0.107:3001/socket.io/?transport=polling&b64=1&Authorization=JWT%20eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1OTk2ZTAyYmVlMjZiNDAyMmM0YmJiNGIiLCJpYXQiOjE1MTE0MzQ0MDksImF1ZCI6Ill1dml0aW1lLmNvbS5hdSIsImlzcyI6Ill1dml0aW1lLmNvbSJ9.UQ-jAL5tWqbg0bjLN3Bq42flKwLovQ6lpr72LexWnwqgr1Tpw03Uf1RM-I51L_WwGPnYooottSqiqQLP0UxvJ_3ejddC2pBR2Zu_UUSdaqhRU1xVCKtPeMv-P4ctRPzUu0qq-ySKNWZI9wb1XrSADQ0lKdfXqkPB39_2k73TfiAlhQ4O_CA7pdfwQ9p2b6KFf3gpTvJe_JQX1Boz7TamPso3rGvK97Q0v0kJ7Pb01axsFDH5vxRUca1upaOK1-FrWOdlY3iWJwzxHtDWsgzeVfStSv-GQmE-mdu7J0QYdBNY8DekSV5OY3sx9mfOvplkM9bLY8EHEWAcT4UQ_cdXtg
2017-11-23 17:51:33.074124+0530 [8044:2460068] -[AppDelegate applicationDidBecomeActive:]
2017-11-23 17:51:33.074203+0530 [8044:2460068] SocketIOClientStatus 2
2017-11-23 17:51:33.078545+0530 [8044:2460183] LOG SocketEnginePolling: Got polling response
2017-11-23 17:51:33.078851+0530 [8044:2460183] LOG SocketEnginePolling: Got poll message: 96:0{"sid":"gg5eNok9X4K82OOzAAAK","upgrades":["websocket"],"pingInterval":3000,"pingTimeout":10000}
2017-11-23 17:51:33.080744+0530 [8044:2460183] LOG SocketEngine: Got message: 0{"sid":"gg5eNok9X4K82OOzAAAK","upgrades":["websocket"],"pingInterval":3000,"pingTimeout":10000}
2017-11-23 17:51:33.094501+0530 [8044:2460183] LOG SocketEngine: Writing poll:  has data: false
2017-11-23 17:51:33.094614+0530 [8044:2460183] LOG SocketEnginePolling: Sending poll:  as type: 2
2017-11-23 17:51:33.099496+0530 [8044:2460183] LOG SocketEnginePolling: Created POST string: 1:2
2017-11-23 17:51:33.099926+0530 [8044:2460183] LOG SocketEnginePolling: POSTing
2017-11-23 17:51:33.102227+0530 [8044:2460203] LOG SocketEngine: Engine is being released

0 个答案:

没有答案