Skip to content

Commit 2e31593

Browse files
committed
Add webSocketServer and webSocketPort in EMOptions for private deploy.
1 parent 47d77fb commit 2e31593

File tree

4 files changed

+84
-4
lines changed

4 files changed

+84
-4
lines changed

im_flutter_sdk/example/ios/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
PODS:
22
- AgoraInfra_iOS (1.3.0)
33
- Flutter (1.0.0)
4-
- HyphenateChat (4.16.2):
4+
- HyphenateChat (4.17.1):
55
- AgoraInfra_iOS (~> 1.3.0)
66
- im_flutter_sdk_ios (4.15.2):
77
- Flutter
8-
- HyphenateChat (= 4.16.2)
8+
- HyphenateChat (= 4.17.1)
99

1010
DEPENDENCIES:
1111
- Flutter (from `Flutter`)
@@ -25,8 +25,8 @@ EXTERNAL SOURCES:
2525
SPEC CHECKSUMS:
2626
AgoraInfra_iOS: bfbe01cc1cbc8cdd6fa2cba50393e621fd859c6b
2727
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
28-
HyphenateChat: 05918e069e96a19e4c13e0b4be41a9ac3eeba5d0
29-
im_flutter_sdk_ios: 76fc6ec20105bb45c9308e12002613d9fb4f259a
28+
HyphenateChat: b41e58b4d6731e0ee38aa52253dfc38caad6db38
29+
im_flutter_sdk_ios: 85e0cf97f4e788b0479c90155f9ba6572512bc8d
3030

3131
PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e
3232

im_flutter_sdk/lib/src/models/em_options.dart

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,34 @@ class EMOptions {
271271
/// ~end
272272
final int? imPort;
273273

274+
/// ~english
275+
/// The WebSocket server.
276+
///
277+
/// This property is effective only when `enableDnsConfig` is `NO`.
278+
/// Can only be set when initializing the SDK with [EMClient.init], cannot be altered in runtime.
279+
/// ~end
280+
///
281+
/// ~chinese
282+
/// WebSocket 服务器地址。
283+
///
284+
/// enableDnsConfig 为 NO 时生效。只能在 [EMClient.init] 中设置,不能在程序运行过程中动态修改。
285+
/// ~end
286+
final String? webSocketServer;
287+
288+
/// ~english
289+
/// The WebSocket server port.
290+
///
291+
/// This property is effective only when `enableDnsConfig` is `NO`.
292+
/// Can only be set when initializing the SDK with [EMClient.init], cannot be altered in runtime.
293+
/// ~end
294+
///
295+
/// ~chinese
296+
/// WebSocket 服务器端口。
297+
///
298+
/// enableDnsConfig 为 NO 时生效。只能在 [EMClient.init] 中设置,不能在程序运行过程中动态修改。
299+
/// ~end
300+
final int? webSocketPort;
301+
274302
/// ~english
275303
/// Whether to enable TLS connection, which takes effect during initialization and is false by default.
276304
/// ~end
@@ -586,6 +614,10 @@ class EMOptions {
586614
///
587615
/// Param [imServer] The IM server URL for private deployment.
588616
///
617+
/// Param [webSocketServer] The WebSocket server for private deployments.
618+
///
619+
/// Param [webSocketPort] The WebSocket server port for private deployments.
620+
///
589621
/// Param [chatAreaCode] The area code.
590622
///
591623
/// Param [enableEmptyConversation] Whether to include empty conversations when the SDK loads conversations from the local database.
@@ -682,6 +714,10 @@ class EMOptions {
682714
///
683715
/// Param [imServer] 私有部署时的 IM 服务器地址。
684716
///
717+
/// Param [webSocketServer] 私有部署时的 WebSocket 服务器地址。
718+
///
719+
/// Param [webSocketPort] 私有部署时的 WebSocket 服务器端口。
720+
///
685721
/// Param [chatAreaCode] server 区域码.
686722
///
687723
/// Param [enableEmptyConversation] 从本地数据库加载会话时是否包括空会话。
@@ -728,6 +764,8 @@ class EMOptions {
728764
String? restServer,
729765
int? imPort,
730766
String? imServer,
767+
String? webSocketServer,
768+
int? webSocketPort,
731769
int? chatAreaCode,
732770
bool enableEmptyConversation = false,
733771
String? deviceName,
@@ -759,6 +797,8 @@ class EMOptions {
759797
restServer: restServer,
760798
imPort: imPort,
761799
imServer: imServer,
800+
webSocketServer: webSocketServer,
801+
webSocketPort: webSocketPort,
762802
chatAreaCode: chatAreaCode ?? ChatAreaCode.GLOB,
763803
enableEmptyConversation: enableEmptyConversation,
764804
deviceName: deviceName,
@@ -841,6 +881,10 @@ class EMOptions {
841881
///
842882
/// Param [imServer] The IM server URL for private deployment.
843883
///
884+
/// Param [webSocketServer] The WebSocket server for private deployments.
885+
///
886+
/// Param [webSocketPort] The WebSocket server port for private deployments.
887+
///
844888
/// Param [chatAreaCode] The area code.
845889
///
846890
/// Param [enableEmptyConversation] Whether to include empty conversations when the SDK loads conversations from the local database.
@@ -937,6 +981,10 @@ class EMOptions {
937981
///
938982
/// Param [imServer] 私有部署时的 IM 服务器地址。
939983
///
984+
/// Param [webSocketServer] 私有部署时的 WebSocket 服务器地址。
985+
///
986+
/// Param [webSocketPort] 私有部署时的 WebSocket 服务器端口。
987+
///
940988
/// Param [chatAreaCode] server 区域码.
941989
///
942990
/// Param [enableEmptyConversation] 从本地数据库加载会话时是否包括空会话。
@@ -983,6 +1031,8 @@ class EMOptions {
9831031
String? restServer,
9841032
int? imPort,
9851033
String? imServer,
1034+
String? webSocketServer,
1035+
int? webSocketPort,
9861036
int? chatAreaCode,
9871037
bool enableEmptyConversation = false,
9881038
String? deviceName,
@@ -1014,6 +1064,8 @@ class EMOptions {
10141064
restServer: restServer,
10151065
imPort: imPort,
10161066
imServer: imServer,
1067+
webSocketServer: webSocketServer,
1068+
webSocketPort: webSocketPort,
10171069
chatAreaCode: chatAreaCode ?? ChatAreaCode.GLOB,
10181070
enableEmptyConversation: enableEmptyConversation,
10191071
deviceName: deviceName,
@@ -1098,6 +1150,10 @@ class EMOptions {
10981150
///
10991151
/// Param [imServer] The IM server URL for private deployment.
11001152
///
1153+
/// Param [webSocketServer] The WebSocket server for private deployments.
1154+
///
1155+
/// Param [webSocketPort] The WebSocket server port for private deployments.
1156+
///
11011157
/// Param [chatAreaCode] The area code.
11021158
///
11031159
/// Param [enableEmptyConversation] Whether to include empty conversations when the SDK loads conversations from the local database.
@@ -1194,6 +1250,10 @@ class EMOptions {
11941250
///
11951251
/// Param [imServer] 私有部署时的 IM 服务器地址。
11961252
///
1253+
/// Param [webSocketServer] 私有部署时的 WebSocket 服务器地址。
1254+
///
1255+
/// Param [webSocketPort] 私有部署时的 WebSocket 服务器端口。
1256+
///
11971257
/// Param [chatAreaCode] server 区域码.
11981258
///
11991259
/// Param [enableEmptyConversation] 从本地数据库加载会话时是否包括空会话。
@@ -1240,6 +1300,8 @@ class EMOptions {
12401300
String? restServer,
12411301
int? imPort,
12421302
String? imServer,
1303+
String? webSocketServer,
1304+
int? webSocketPort,
12431305
int? chatAreaCode,
12441306
bool enableEmptyConversation = false,
12451307
String? deviceName,
@@ -1270,6 +1332,8 @@ class EMOptions {
12701332
restServer: restServer,
12711333
imPort: imPort,
12721334
imServer: imServer,
1335+
webSocketServer: webSocketServer,
1336+
webSocketPort: webSocketPort,
12731337
chatAreaCode: chatAreaCode ?? ChatAreaCode.GLOB,
12741338
enableEmptyConversation: enableEmptyConversation,
12751339
deviceName: deviceName,
@@ -1304,6 +1368,8 @@ class EMOptions {
13041368
this.restServer,
13051369
this.imPort,
13061370
this.imServer,
1371+
this.webSocketServer,
1372+
this.webSocketPort,
13071373
this.chatAreaCode = ChatAreaCode.GLOB,
13081374
this.enableEmptyConversation = false,
13091375
this.deviceName,
@@ -1335,6 +1401,8 @@ class EMOptions {
13351401
data.putIfNotNull("enableDNSConfig", enableDNSConfig);
13361402
data.putIfNotNull("imPort", imPort);
13371403
data.putIfNotNull("imServer", imServer);
1404+
data.putIfNotNull("webSocketServer", webSocketServer);
1405+
data.putIfNotNull("webSocketPort", webSocketPort);
13381406
data.putIfNotNull("isAutoDownload", isAutoDownloadThumbnail);
13391407
data.putIfNotNull(
13401408
"isChatRoomOwnerLeaveAllowed", isChatRoomOwnerLeaveAllowed);
@@ -1426,6 +1494,8 @@ class EMOptions {
14261494
restServer: restServer,
14271495
imPort: imPort,
14281496
imServer: imServer,
1497+
webSocketServer: webSocketServer,
1498+
webSocketPort: webSocketPort,
14291499
chatAreaCode: chatAreaCode,
14301500
enableEmptyConversation: enableEmptyConversation,
14311501
deviceName: deviceName,

im_flutter_sdk_android/android/src/main/java/com/easemob/im_flutter_sdk/EMHelper.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ static EMOptions fromJson(JSONObject json, Context context) throws JSONException
9797
if (json.has("imServer")) {
9898
options.setIMServer(json.getString("imServer"));
9999
}
100+
if (json.has("webSocketServer")) {
101+
options.setWebSocketServer(json.getString("webSocketServer"));
102+
}
103+
if (json.has("webSocketPort")) {
104+
options.setWebSocketPort(json.getInt("webSocketPort"));
105+
}
100106
if (json.has("restServer")) {
101107
options.setRestServer(json.getString("restServer"));
102108
}

im_flutter_sdk_ios/ios/Classes/OptionsHelper.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ - (NSDictionary *)toJson {
3030
data[@"enableDNSConfig"] = @(self.enableDnsConfig);
3131
data[@"imPort"] = @(self.chatPort);
3232
data[@"imServer"] = self.chatServer;
33+
data[@"webSocketServer"] = self.webSocketServer;
34+
data[@"webSocketPort"] = @(self.webSocketPort);
3335
data[@"restServer"] = self.restServer;
3436
data[@"dnsUrl"] = self.dnsURL;
3537
data[@"areaCode"] = @(self.area);
@@ -73,6 +75,8 @@ + (EMOptions *)fromJson:(NSDictionary *)aJson {
7375
options.enableDnsConfig = [aJson[@"enableDNSConfig"] boolValue];
7476
options.chatPort = [aJson[@"imPort"] intValue];
7577
options.chatServer = aJson[@"imServer"];
78+
options.webSocketServer = aJson[@"webSocketServer"];
79+
options.webSocketPort = [aJson[@"webSocketPort"] intValue];
7680
options.restServer = aJson[@"restServer"];
7781
options.dnsURL = aJson[@"dnsURL"];
7882
options.area = [aJson[@"areaCode"] intValue];

0 commit comments

Comments
 (0)