/FanapPodAsyncSDK

An async client that manages the connection to the async server.

Primary LanguageSwiftApache License 2.0Apache-2.0

FanapPodAsyncSDK



Fanap's POD Async iOS SDK

Features

  • Simplify Socket connection to Async server

Installation

Swift Package Manager(SPM)

Add in Package.swift or directly in Xcode Project dependencies section:

.package(url: "https://pubgi.fanapsoft.ir/chat/ios/fanappodasyncsdk.git", .upToNextMinor(from: "1.2.0")),

Add in Podfile:

pod 'FanapPodAsyncSDK'

Intit

let asyncConfig = AsyncConfigBuilder()
            .socketAddress("socketAddresss")
            .reconnectCount(Int.max)
            .reconnectOnClose(true)
            .appId("PodChat")
            .serverName("serverName")
            .isDebuggingLogEnabled(false)
            .build()
let async = Async(config: asyncConfig, delegate: self)
async.createSocket()

Connection State

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{
        // Write your code here.
    }
}


Send data

async.sendData(type: .message, message: message)


For more information about how to use Async SDK visit Documentation

For more example and usage you can use developer implementation app

Contributing to FanapPodAsyncSDK

Please see the contributing guide for more information.