Browse Source

Update rpc.txt

felix 2 years ago
parent
commit
f97be18543
1 changed files with 9 additions and 15 deletions
  1. 9 15
      rpc.txt

+ 9 - 15
rpc.txt

@@ -3,6 +3,7 @@ library fis_jsonrpc;
 import 'dart:collection';
 
 import 'package:fis_common/extensions/type.dart';
+import 'package:fis_common/logger/logger.dart';
 
 import 'client_base.dart';
 import 'interceptor.dart';
@@ -16,31 +17,26 @@ export 'notifications/index.dart';
 
 typedef T ServiceBuilder<T extends JsonRpcClientBase>();
 
-/// 默认地址标识
-const String _defaultAddressSign = "FLYINSONO";
+const C_SHELL_RPC_DEFAULT_HOST = 'platform.fis.plus';
 
 /// JSON-RPC 代理
 class JsonRpcProxy {
   JsonRpcProxy({
-    this.defaultServerHost = "cloud.fis.plus",
-    this.platformHost = "platform.fis.plus",
+    String? host,
+    this.platformHost = C_SHELL_RPC_DEFAULT_HOST,
   }) {
-    _currentHost = this.defaultServerHost;
+    _currentHost = host ?? "unknown";
   }
 
-  /// 默认主机地址
-  final String defaultServerHost;
-
   /// 宿主平台代理地址
   final String platformHost;
 
+  /// 服务主机地址
   late String _currentHost;
 
   /// 当前服务主机地址
   String get currentHostAddress => "http://$_currentHost";
 
-  String get defaultAddressSign => _defaultAddressSign;
-
   HashMap<Type, dynamic> _serviceCache = HashMap();
 
   static PlatformService? _platformService;
@@ -54,16 +50,14 @@ class JsonRpcProxy {
     return _platformService!;
   }
 *******Separator******
-    /* 服务代理设置 End */
+  /* 服务代理设置 End */
 
   /// 设置服务主机地址
   void setServerHost(String address) {
-    if (address == _defaultAddressSign) {
-      address = defaultServerHost;
-    }
+    logger.i('JsonRpcProxy setServerHost :' + address);
     _currentHost = address;
   }
-  
+
   /// 添加拦截器
   void addInterceptor(JsonRpcInterceptor interceptor) =>
       jsonRpcInterceptHost.addInterceptor(interceptor);