         
         var result: (server: String, lpKey: String, ts: String)?
         
-        APIScope.Messages.getLongPollServer([.useSsl: "0", .needPts: "1", .lpVersion: "2"])
+        APIScope.Messages.getLongPollServer([
+            .useSsl: "0",
+            .needPts: "1",
+            .lpVersion: version.rawValue
+            ])
             .configure(with: Config(attemptsMaxLimit: 1, handleErrors: false))
             .onSuccess { data in
                 defer { semaphore.signal() }

import Foundation

/// Long poll client
public protocol LongPoll {

    
    /// Start recieve long poll events
    /// parameters onReceiveEvents: clousure ehich executes when long poll recieve set of events
    func start(version: LongPollVersion, onReceiveEvents: @escaping ([LongPollEvent]) -> ())
    
    /// Stop recieve long poll events
    func stop()
}

extension LongPoll {
    func start(version: LongPollVersion = .latest, onReceiveEvents: @escaping ([LongPollEvent]) -> ()) {
        start(version: version, onReceiveEvents: onReceiveEvents)
    }
}

public final class LongPollImpl: LongPoll {
