mezon-js 2.9.41 → 2.9.42
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/mezon-js.cjs.js +4 -4
- package/dist/mezon-js.esm.mjs +4 -4
- package/dist/socket.d.ts +2 -2
- package/dist/web_socket_adapter.d.ts +2 -2
- package/package.json +1 -1
- package/socket.ts +3 -3
- package/web_socket_adapter.ts +3 -3
package/dist/mezon-js.cjs.js
CHANGED
@@ -6044,13 +6044,13 @@ var WebSocketAdapterText = class {
|
|
6044
6044
|
var _a;
|
6045
6045
|
return ((_a = this._socket) == null ? void 0 : _a.readyState) == WebSocket.OPEN;
|
6046
6046
|
}
|
6047
|
-
connect(scheme, host, port, createStatus, token, signal) {
|
6047
|
+
connect(scheme, host, port, createStatus, token, platform, signal) {
|
6048
6048
|
if (signal) {
|
6049
6049
|
signal.addEventListener("abort", () => {
|
6050
6050
|
this.close();
|
6051
6051
|
});
|
6052
6052
|
}
|
6053
|
-
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}`;
|
6053
|
+
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}&paltform=${encodeURIComponent(platform)}`;
|
6054
6054
|
this._socket = new WebSocket(url);
|
6055
6055
|
}
|
6056
6056
|
close() {
|
@@ -6093,12 +6093,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6093
6093
|
isOpen() {
|
6094
6094
|
return this.adapter.isOpen();
|
6095
6095
|
}
|
6096
|
-
connect(session, createStatus = false, connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
|
6096
|
+
connect(session, createStatus = false, platform = "", connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
|
6097
6097
|
if (this.adapter.isOpen()) {
|
6098
6098
|
return Promise.resolve(session);
|
6099
6099
|
}
|
6100
6100
|
const scheme = this.useSSL ? "wss://" : "ws://";
|
6101
|
-
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, signal);
|
6101
|
+
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, platform, signal);
|
6102
6102
|
this.adapter.onClose = (evt) => {
|
6103
6103
|
this.ondisconnect(evt);
|
6104
6104
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -6015,13 +6015,13 @@ var WebSocketAdapterText = class {
|
|
6015
6015
|
var _a;
|
6016
6016
|
return ((_a = this._socket) == null ? void 0 : _a.readyState) == WebSocket.OPEN;
|
6017
6017
|
}
|
6018
|
-
connect(scheme, host, port, createStatus, token, signal) {
|
6018
|
+
connect(scheme, host, port, createStatus, token, platform, signal) {
|
6019
6019
|
if (signal) {
|
6020
6020
|
signal.addEventListener("abort", () => {
|
6021
6021
|
this.close();
|
6022
6022
|
});
|
6023
6023
|
}
|
6024
|
-
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}`;
|
6024
|
+
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}&paltform=${encodeURIComponent(platform)}`;
|
6025
6025
|
this._socket = new WebSocket(url);
|
6026
6026
|
}
|
6027
6027
|
close() {
|
@@ -6064,12 +6064,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6064
6064
|
isOpen() {
|
6065
6065
|
return this.adapter.isOpen();
|
6066
6066
|
}
|
6067
|
-
connect(session, createStatus = false, connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
|
6067
|
+
connect(session, createStatus = false, platform = "", connectTimeoutMs = _DefaultSocket.DefaultConnectTimeoutMs, signal) {
|
6068
6068
|
if (this.adapter.isOpen()) {
|
6069
6069
|
return Promise.resolve(session);
|
6070
6070
|
}
|
6071
6071
|
const scheme = this.useSSL ? "wss://" : "ws://";
|
6072
|
-
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, signal);
|
6072
|
+
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, platform, signal);
|
6073
6073
|
this.adapter.onClose = (evt) => {
|
6074
6074
|
this.ondisconnect(evt);
|
6075
6075
|
};
|
package/dist/socket.d.ts
CHANGED
@@ -574,7 +574,7 @@ export interface Socket {
|
|
574
574
|
/** Connection is Open */
|
575
575
|
isOpen(): boolean;
|
576
576
|
/** Connect to the server. */
|
577
|
-
connect(session: Session, createStatus: boolean, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
577
|
+
connect(session: Session, createStatus: boolean, platform: string, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
578
578
|
/** Disconnect from the server. */
|
579
579
|
disconnect(fireDisconnectEvent: boolean): void;
|
580
580
|
/** Subscribe to one or more users for their status updates. */
|
@@ -704,7 +704,7 @@ export declare class DefaultSocket implements Socket {
|
|
704
704
|
constructor(host: string, port: string, useSSL?: boolean, verbose?: boolean, adapter?: WebSocketAdapter, sendTimeoutMs?: number);
|
705
705
|
generatecid(): string;
|
706
706
|
isOpen(): boolean;
|
707
|
-
connect(session: Session, createStatus?: boolean, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
707
|
+
connect(session: Session, createStatus?: boolean, platform?: string, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
708
708
|
disconnect(fireDisconnectEvent?: boolean): void;
|
709
709
|
setHeartbeatTimeoutMs(ms: number): void;
|
710
710
|
getHeartbeatTimeoutMs(): number;
|
@@ -35,7 +35,7 @@ export interface WebSocketAdapter {
|
|
35
35
|
onOpen: SocketOpenHandler | null;
|
36
36
|
isOpen(): boolean;
|
37
37
|
close(): void;
|
38
|
-
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void;
|
38
|
+
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
|
39
39
|
send(message: any): void;
|
40
40
|
}
|
41
41
|
/**
|
@@ -77,7 +77,7 @@ export declare class WebSocketAdapterText implements WebSocketAdapter {
|
|
77
77
|
get onOpen(): SocketOpenHandler | null;
|
78
78
|
set onOpen(value: SocketOpenHandler | null);
|
79
79
|
isOpen(): boolean;
|
80
|
-
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void;
|
80
|
+
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
|
81
81
|
close(): void;
|
82
82
|
send(msg: any): void;
|
83
83
|
}
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -801,7 +801,7 @@ export interface Socket {
|
|
801
801
|
isOpen(): boolean;
|
802
802
|
|
803
803
|
/** Connect to the server. */
|
804
|
-
connect(session: Session, createStatus: boolean, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
804
|
+
connect(session: Session, createStatus: boolean, platform: string, connectTimeoutMs?: number, signal?: AbortSignal): Promise<Session>;
|
805
805
|
|
806
806
|
/** Disconnect from the server. */
|
807
807
|
disconnect(fireDisconnectEvent: boolean): void;
|
@@ -1029,13 +1029,13 @@ export class DefaultSocket implements Socket {
|
|
1029
1029
|
return this.adapter.isOpen();
|
1030
1030
|
}
|
1031
1031
|
|
1032
|
-
connect(session: Session, createStatus: boolean = false, connectTimeoutMs: number = DefaultSocket.DefaultConnectTimeoutMs, signal?: AbortSignal): Promise<Session> {
|
1032
|
+
connect(session: Session, createStatus: boolean = false, platform: string = "", connectTimeoutMs: number = DefaultSocket.DefaultConnectTimeoutMs, signal?: AbortSignal): Promise<Session> {
|
1033
1033
|
if (this.adapter.isOpen()) {
|
1034
1034
|
return Promise.resolve(session);
|
1035
1035
|
}
|
1036
1036
|
|
1037
1037
|
const scheme = (this.useSSL) ? "wss://" : "ws://";
|
1038
|
-
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, signal);
|
1038
|
+
this.adapter.connect(scheme, this.host, this.port, createStatus, session.token, platform, signal);
|
1039
1039
|
|
1040
1040
|
this.adapter.onClose = (evt: Event) => {
|
1041
1041
|
this.ondisconnect(evt);
|
package/web_socket_adapter.ts
CHANGED
@@ -44,7 +44,7 @@ export interface WebSocketAdapter {
|
|
44
44
|
|
45
45
|
isOpen(): boolean;
|
46
46
|
close(): void;
|
47
|
-
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void;
|
47
|
+
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
|
48
48
|
send(message: any): void;
|
49
49
|
}
|
50
50
|
|
@@ -131,13 +131,13 @@ export class WebSocketAdapterText implements WebSocketAdapter {
|
|
131
131
|
return this._socket?.readyState == WebSocket.OPEN;
|
132
132
|
}
|
133
133
|
|
134
|
-
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, signal?: AbortSignal): void {
|
134
|
+
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void {
|
135
135
|
if (signal) {
|
136
136
|
signal.addEventListener('abort', () => {
|
137
137
|
this.close();
|
138
138
|
});
|
139
139
|
}
|
140
|
-
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}`;
|
140
|
+
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(createStatus.toString())}&token=${encodeURIComponent(token)}&paltform=${encodeURIComponent(platform)}`;
|
141
141
|
this._socket = new WebSocket(url);
|
142
142
|
}
|
143
143
|
|