Skip to content

arzrasel/SocketKitIO

Repository files navigation

SocketKitIO

Rz Rasel CI Status Version License Platform GitHub release Swift Xcode

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • iOS 11
  • Swift 5
  • Xcode 12

Installation

SocketKitIO is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SocketKitIO'

or

pod 'SocketKitIO', '~> 1.0'

## Integration In Project

```IntegrationInProject
import SocketIOClient

SocketIOClient declaration

let socketIOManager = SocketIOManager(isLog: true)

SocketIOClient setup

func setupIncoming() {
    //Initial setup
    socketIOManager.params(key: "SOCKET_AUTH_KEY", value: "SOCKET_AUTH_TOKEN")
        .with(url: AppConstant.HTTP.API.SOCKET_IO)
    socketIOManager.prepareConnection()
    //Socket response setup
    //Response One
    socketIOManager.socketOn(name: "SOCKET_KEY_ONE") {name, data, ack in
        print("Socket key name: \(name), socket data: \(data)")
    }
    socketIOManager.socketOn(name: "SOCKET_KEY_TWO") {name, data, ack in
        print("Socket key name: \(name), socket data: \(data)")
    }
    //...
    /*
    //As many as you have need
    */
}

SocketIOClient setup

let emitData = [
    "key": "value",
    "key": "value",
    "key": "value",
    "key": "value"
    //....
]
socketIOManager.emit(name: "SOCKET_KEY_ONE", params: emitData)

Author

Md. Rashed - Uz - Zaman (Rz Rasel)

License

SocketKitIO is available under the MIT license. See the LICENSE file for more info.