Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.

Installation and Configuration

Roman Baitaliuk edited this page May 31, 2018 · 7 revisions

Installation

ClusterWS-Client-Swift is compatible with CocoaPods. With CocoaPods, just add this to your Podfile:

pod 'ClusterWS-Client-Swift', '~> 3.0.2'

Configuration

To connect to the server use ClusterWS instance:

let webSocket = ClusterWS(url: "ws://localhost:80")
webSocket.delegate = self
webSocket.connect()

Optional configurations

/**
    autoReconnect: Bool - allow to auto-reconnect to the server on lost connection (default false),
    reconnectionIntervalMin: Double - how often it will try to reconnect in seconds (default 1.0),
    reconnectionIntervalMax: Double - how often it will try to reconnect in seconds (default 5.0),
    reconnectionAttempts: Int - how many attempts, 0 means without limit (default 0)
*/
webSocket.setReconnection(autoReconnect: true, reconnectionIntervalMin: 1.0, reconnectionIntervalMax: 5.0, reconnectionAttempts: 0)