-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from youngmonkeys/add-ping-config
add ping config
- Loading branch information
Showing
7 changed files
with
109 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// EzyPingConfig.swift | ||
// freechat-swift | ||
// | ||
// Created by Dzung on 04/09/2021. | ||
// Copyright © 2021 Young Monkeys. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public class EzyPingConfig { | ||
|
||
var pingPeriod: Int = 3000 | ||
var maxLostPingCount: Int = 5 | ||
|
||
func setPingPeriod(pingPeriod: Int) -> EzyPingConfig { | ||
self.pingPeriod = pingPeriod | ||
return self | ||
} | ||
|
||
func setMaxLostPingCount(maxLostPingCount: Int) -> EzyPingConfig { | ||
self.maxLostPingCount = maxLostPingCount | ||
return self | ||
} | ||
|
||
func toDictionary() -> NSDictionary { | ||
let dict = NSMutableDictionary() | ||
dict["pingPeriod"] = pingPeriod | ||
dict["maxLostPingCount"] = maxLostPingCount | ||
return dict | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// EzyReconnectConfig.swift | ||
// freechat-swift | ||
// | ||
// Created by Dzung on 04/09/2021. | ||
// Copyright © 2021 Young Monkeys. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
public class EzyReconnectConfig { | ||
|
||
var enable: Bool = true | ||
var maxReconnectCount: Int = 5 | ||
var reconnectPeriod: Int = 3000 | ||
|
||
func setEnable(enable: Bool) -> EzyReconnectConfig { | ||
self.enable = enable | ||
return self | ||
} | ||
|
||
func setMaxReconnectCount(maxReconnectCount: Int) -> EzyReconnectConfig { | ||
self.maxReconnectCount = maxReconnectCount | ||
return self | ||
} | ||
|
||
func setReconnectPeriod(reconnectPeriod: Int) -> EzyReconnectConfig { | ||
self.reconnectPeriod = reconnectPeriod | ||
return self | ||
} | ||
|
||
func toDictionary() -> NSDictionary { | ||
let dict = NSMutableDictionary() | ||
dict["enable"] = enable | ||
dict["maxReconnectCount"] = maxReconnectCount | ||
dict["reconnectPeriod"] = reconnectPeriod | ||
return dict | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule socket
updated
14 files
+15 −0 | .gitignore | |
+1 −1 | README.md | |
+28 −0 | example/CMakeLists.txt | |
+79 −0 | example/main.cpp | |
+1 −1 | src/EzyClient.cpp | |
+16 −5 | src/codec/EzyEncryption.cpp | |
+13 −0 | src/config/EzyClientConfig.cpp | |
+14 −0 | src/config/EzyClientConfig.h | |
+1 −0 | src/logger/EzyLogger.cpp | |
+1 −1 | src/manager/EzyAppManager.cpp | |
+4 −3 | src/manager/EzyPingManager.cpp | |
+5 −1 | src/manager/EzyPingManager.h | |
+2 −2 | src/socket/EzyPingSchedule.cpp | |
+3 −1 | src/socket/EzySocketClient.cpp |