2
0
mirror of https://github.com/esiur/esiur-js.git synced 2025-09-13 07:03:18 +00:00

GetTypeUUID+wsUrl

This commit is contained in:
2025-07-23 20:53:05 +03:00
parent 9c13c3e7ae
commit c6c2e749be
4 changed files with 17 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "esiur",
"version": "2.3.3",
"version": "2.3.4",
"description": "Distributed Object Framework",
"main": "esiur.js",
"type": "module",

View File

@@ -104,7 +104,6 @@ export default class DistributedConnection extends IStore {
// fields
#port;
#hostname;
#secure;
#socket;
#lastKeepAliveSent;
@@ -1347,7 +1346,8 @@ export default class DistributedConnection extends IStore {
keepAliveInterval = 30,
keepAliveTime = 10,
reconnectInterval = 5,
authenticator = null} = this.instance.attributes.toObject();
authenticator = null,
wsUrl = ""} = this.instance.attributes.toObject();
this.authenticator = authenticator;
@@ -1369,16 +1369,16 @@ export default class DistributedConnection extends IStore {
&& password != null)
{
var pw = DC.stringToBytes(password);
return this.connect(AuthenticationMethod.Credentials, null, address, port, username, null, pw, domain, secure);
return this.connect(AuthenticationMethod.Credentials, null, address, port, username, null, pw, domain, secure, wsUrl);
}
else if (token != null)
{
var tk = token instanceof Uint8Array ? token : DC.stringToBytes(token);
return this.connect(AuthenticationMethod.Token, null, address, port, null, tokenIndex, tk, domain, secure);
return this.connect(AuthenticationMethod.Token, null, address, port, null, tokenIndex, tk, domain, secure, wsUrl);
}
else
{
return this.connect(AuthenticationMethod.None, null, address, port, null, 0, null, domain, secure);
return this.connect(AuthenticationMethod.None, null, address, port, null, 0, null, domain, secure, wsUrl);
}
}
@@ -1387,7 +1387,7 @@ export default class DistributedConnection extends IStore {
connect(method = AuthenticationMethod.Certificate, socket = null, hostname = null, port = 0,
username = null, tokenIndex = 0, passwordOrToken = null, domain = null, secure = false)
username = null, tokenIndex = 0, passwordOrToken = null, domain = null, secure = false, wsUrl = "")
{
if (this.#openReply != null)
@@ -1440,7 +1440,10 @@ export default class DistributedConnection extends IStore {
this.#hostname = hostname;
if (secure != null)
this.#secure = secure;
socket.secure = secure;
if (wsUrl != null)
socket.wsUrl = wsUrl;
this.#connectSocket(socket);
@@ -1451,7 +1454,7 @@ export default class DistributedConnection extends IStore {
#connectSocket(socket){
let self = this;
socket.connect(this.#hostname, this.#port, this.#secure).then(x =>
socket.connect(this.#hostname, this.#port).then(x =>
{
self.assign(socket);
}).error((x) =>

View File

@@ -13,6 +13,8 @@ export default class WSocket extends ISocket
this.receiveNetworkBuffer = new NetworkBuffer();
this.sendNetworkBuffer = new NetworkBuffer();
this.held = false;
this.wsUrl = "";
this.secure = false;
if (websocket != null)
{
@@ -84,12 +86,12 @@ export default class WSocket extends ISocket
return WSocket.webSocket;
}
connect(hostname, port, secure = false) {
connect(hostname, port) {
let self = this;
var rt = new AsyncReply();
this.state = SocketState.Connecting;
this.url = `ws${secure ? 's' : ''}://${hostname}:${port}`;
this.url = `ws${this.secure ? 's' : ''}://${hostname}:${port}/${this.wsUrl}`;
WSocket.getWebScoket().then(webSocket =>
{

View File

@@ -266,7 +266,7 @@ export default class TypeTemplate {
// set UUID
this.className = describer.namespace + "." + (describer.className ?? type.prototype.constructor.name);
this.classId = describer.classId ?? SHA256.compute(DC.stringToBytes(this.className)).getUUID(0);
this.classId = describer.classId ?? TypeTemplate.getTypeUUIDByName(this.className);// SHA256.compute(DC.stringToBytes(this.className)).getUUID(0);
if (addToWarehouse)