mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-09-13 12:03:18 +00:00
wsUrl
This commit is contained in:
@@ -217,11 +217,14 @@ class DistributedConnection extends NetworkConnection implements IStore {
|
||||
|
||||
var domain = instance?.attributes["domain"].toString() ?? address;
|
||||
|
||||
|
||||
var ws = instance?.attributes.containsKey("ws") == true ||
|
||||
instance?.attributes.containsKey("wss") == true;
|
||||
var secure = instance?.attributes.containsKey("secure") == true ||
|
||||
instance?.attributes.containsKey("wss") == true;
|
||||
|
||||
var wsUrl = instance?.attributes["wsUrl"].toString() ?? "";
|
||||
|
||||
if (instance?.attributes.containsKey("autoReconnect") ?? false)
|
||||
autoReconnect = instance?.attributes["autoReconnect"] == true;
|
||||
|
||||
@@ -248,6 +251,7 @@ class DistributedConnection extends NetworkConnection implements IStore {
|
||||
passwordOrToken: password,
|
||||
username: username,
|
||||
useWebsocket: ws,
|
||||
wsUrl: wsUrl,
|
||||
secureWebSocket: secure);
|
||||
} else if (instance?.attributes.containsKey("token") == true) {
|
||||
var token =
|
||||
@@ -286,7 +290,8 @@ class DistributedConnection extends NetworkConnection implements IStore {
|
||||
DC? passwordOrToken,
|
||||
String? domain,
|
||||
bool useWebsocket = false,
|
||||
bool secureWebSocket = false}) {
|
||||
bool secureWebSocket = false,
|
||||
String wsUrl = ""}) {
|
||||
if (_openReply != null)
|
||||
throw AsyncException(ErrorType.Exception, 0, "Connection in progress");
|
||||
|
||||
@@ -321,7 +326,7 @@ class DistributedConnection extends NetworkConnection implements IStore {
|
||||
|
||||
if (socket == null) {
|
||||
if (useWebsocket || kIsWeb) {
|
||||
socket = new WSocket()..secure = secureWebSocket;
|
||||
socket = WSocket() .. secure = true .. wsUrl = wsUrl;
|
||||
} else
|
||||
socket = new TCPSocket();
|
||||
}
|
||||
|
@@ -50,6 +50,8 @@ class WSocket extends ISocket {
|
||||
|
||||
IPEndPoint? _localEP, _remoteEP;
|
||||
|
||||
String wsUrl = "";
|
||||
|
||||
bool begin() {
|
||||
if (began) return false;
|
||||
|
||||
@@ -100,7 +102,7 @@ class WSocket extends ISocket {
|
||||
_state = SocketState.Connecting;
|
||||
|
||||
_channel = WebSocketChannel.connect(
|
||||
Uri.parse("${secure ? 'wss' : 'ws'}://${hostname}:${port}"),
|
||||
Uri.parse("${secure ? 'wss' : 'ws'}://${hostname}:${port}/${wsUrl}"),
|
||||
); //binaryType: BinaryType.list);
|
||||
|
||||
if (_channel == null)
|
||||
|
Reference in New Issue
Block a user