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

Installation and Configuration

Roman Baitaliuk edited this page Jan 19, 2018 · 10 revisions

Installation

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

pod 'ClusterWS-Client-Swift'

Configuration

To connect to the server use ClusterWS instance:

let webSocket = ClusterWS(url: "host", port: portNumber)
webSocket.delegate = self
webSocket.connect()

Optional configurations

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