Fanap's POD Async iOS SDK
- Simplify Socket connection to Async server
Add in Podfile
:
pod 'FanapPodAsyncSDK'
let asyncConfig = AsyncConfig(socketAddress: socketAddress,
serverName: serverName,
deviceId: deviceId ?? UUID().uuidString,
appId: "PodChat", // PodChat is default app Id
peerId: nil,
messageTtl: messageTtl,
connectionRetryInterval: TimeInterval(connectionRetryInterval),
connectionCheckTimeout: TimeInterval(connectionCheckTimeout),
reconnectCount: reconnectCount,
reconnectOnClose: reconnectOnClose,
isDebuggingLogEnabled: isDebuggingAsyncEnable)
asyncClient = NewAsync(config: asyncConfig, delegate: self)
asyncClient?.createSocket()
Notice: Use the connection only it's in ASYNC_READY state
public func asyncStateChanged(asyncState: AsyncSocketState, error: AsyncError?) {
Chat.sharedInstance.delegate?.chatState(state: asyncState.chatState, currentUser: nil, error: error?.chatError)
if asyncState == .ASYNC_READY{
UserInfoRequestHandler.getUserForChatReady()
}
}
asyncClient?.sendData(type: type, data: data)
For more example and usage you can use developer implementation app