mezon-js-protobuf 1.6.22 → 1.6.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37,7 +37,6 @@ export interface WebSocketAdapter {
|
|
|
37
37
|
close(): void;
|
|
38
38
|
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
|
|
39
39
|
send(message: any): void;
|
|
40
|
-
getRTCPeerConnection(): RTCPeerConnection;
|
|
41
40
|
}
|
|
42
41
|
/**
|
|
43
42
|
* SocketCloseHandler defines a lambda that handles WebSocket close events.
|
|
@@ -64,12 +63,6 @@ export interface SocketMessageHandler {
|
|
|
64
63
|
export interface SocketOpenHandler {
|
|
65
64
|
(this: WebSocket, evt: Event): void;
|
|
66
65
|
}
|
|
67
|
-
export interface RTCPeerOntrackHandler {
|
|
68
|
-
(this: RTCPeerConnection, ev: RTCTrackEvent): any | null;
|
|
69
|
-
}
|
|
70
|
-
export interface RTCPeerOnicecandidateHandler {
|
|
71
|
-
(this: RTCPeerConnection, ev: RTCPeerConnectionIceEvent): any;
|
|
72
|
-
}
|
|
73
66
|
/**
|
|
74
67
|
* A text-based socket adapter that accepts and transmits payloads over UTF-8.
|
|
75
68
|
*/
|
|
@@ -88,5 +81,4 @@ export declare class WebSocketAdapterText implements WebSocketAdapter {
|
|
|
88
81
|
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
|
|
89
82
|
close(): void;
|
|
90
83
|
send(msg: any): void;
|
|
91
|
-
getRTCPeerConnection(): RTCPeerConnection;
|
|
92
84
|
}
|
|
@@ -19,7 +19,6 @@ import { WebSocketAdapter, SocketCloseHandler, SocketErrorHandler, SocketMessage
|
|
|
19
19
|
*/
|
|
20
20
|
export declare class WebSocketAdapterPb implements WebSocketAdapter {
|
|
21
21
|
private _socket?;
|
|
22
|
-
private _pcRef?;
|
|
23
22
|
constructor();
|
|
24
23
|
get onClose(): SocketCloseHandler | null;
|
|
25
24
|
set onClose(value: SocketCloseHandler | null);
|
|
@@ -33,5 +32,4 @@ export declare class WebSocketAdapterPb implements WebSocketAdapter {
|
|
|
33
32
|
close(): void;
|
|
34
33
|
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
|
|
35
34
|
send(msg: any): void;
|
|
36
|
-
getRTCPeerConnection(): RTCPeerConnection;
|
|
37
35
|
}
|
|
@@ -12381,9 +12381,6 @@ var WebSocketAdapterPb = class {
|
|
|
12381
12381
|
)}&format=protobuf&platform=${encodeURIComponent(platform)}`;
|
|
12382
12382
|
this._socket = new WebSocket(url);
|
|
12383
12383
|
this._socket.binaryType = "arraybuffer";
|
|
12384
|
-
this._pcRef = new RTCPeerConnection({
|
|
12385
|
-
iceServers: [{ urls: "stun:stun.l.google.com:19302" }]
|
|
12386
|
-
});
|
|
12387
12384
|
}
|
|
12388
12385
|
send(msg) {
|
|
12389
12386
|
if (msg.match_data_send) {
|
|
@@ -12403,7 +12400,4 @@ var WebSocketAdapterPb = class {
|
|
|
12403
12400
|
const encodedMsg = envelopeWriter.finish();
|
|
12404
12401
|
this._socket.send(encodedMsg);
|
|
12405
12402
|
}
|
|
12406
|
-
getRTCPeerConnection() {
|
|
12407
|
-
return this._pcRef;
|
|
12408
|
-
}
|
|
12409
12403
|
};
|
|
@@ -12368,9 +12368,6 @@ var WebSocketAdapterPb = class {
|
|
|
12368
12368
|
)}&format=protobuf&platform=${encodeURIComponent(platform)}`;
|
|
12369
12369
|
this._socket = new WebSocket(url);
|
|
12370
12370
|
this._socket.binaryType = "arraybuffer";
|
|
12371
|
-
this._pcRef = new RTCPeerConnection({
|
|
12372
|
-
iceServers: [{ urls: "stun:stun.l.google.com:19302" }]
|
|
12373
|
-
});
|
|
12374
12371
|
}
|
|
12375
12372
|
send(msg) {
|
|
12376
12373
|
if (msg.match_data_send) {
|
|
@@ -12390,9 +12387,6 @@ var WebSocketAdapterPb = class {
|
|
|
12390
12387
|
const encodedMsg = envelopeWriter.finish();
|
|
12391
12388
|
this._socket.send(encodedMsg);
|
|
12392
12389
|
}
|
|
12393
|
-
getRTCPeerConnection() {
|
|
12394
|
-
return this._pcRef;
|
|
12395
|
-
}
|
|
12396
12390
|
};
|
|
12397
12391
|
export {
|
|
12398
12392
|
WebSocketAdapterPb
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mezon-js-protobuf",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.23",
|
|
4
4
|
"description": "Websocket adapter adding protocol buffer support to the Mezon Javascript client.",
|
|
5
5
|
"main": "dist/mezon-js-protobuf.cjs.js",
|
|
6
6
|
"module": "dist/mezon-js-protobuf.esm.mjs",
|
package/web_socket_adapter_pb.ts
CHANGED
|
@@ -14,42 +14,36 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
SocketCloseHandler,
|
|
20
|
-
SocketErrorHandler,
|
|
21
|
-
SocketMessageHandler,
|
|
22
|
-
SocketOpenHandler,
|
|
23
|
-
} from "../mezon-js/web_socket_adapter";
|
|
24
|
-
import * as tsproto from "./rtapi/realtime";
|
|
17
|
+
import { WebSocketAdapter, SocketCloseHandler, SocketErrorHandler, SocketMessageHandler, SocketOpenHandler } from "../mezon-js/web_socket_adapter"
|
|
18
|
+
import * as tsproto from "./rtapi/realtime"
|
|
25
19
|
|
|
26
20
|
/**
|
|
27
21
|
* A protocol buffer socket adapter that accepts and transmits payloads using the protobuf binary wire format.
|
|
28
22
|
*/
|
|
29
23
|
export class WebSocketAdapterPb implements WebSocketAdapter {
|
|
30
24
|
private _socket?: WebSocket;
|
|
31
|
-
private _pcRef?: RTCPeerConnection;
|
|
32
25
|
|
|
33
|
-
constructor() {
|
|
26
|
+
constructor() {
|
|
27
|
+
}
|
|
34
28
|
|
|
35
29
|
get onClose(): SocketCloseHandler | null {
|
|
36
|
-
|
|
30
|
+
return this._socket!.onclose;
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
set onClose(value: SocketCloseHandler | null) {
|
|
40
|
-
|
|
34
|
+
this._socket!.onclose = value;
|
|
41
35
|
}
|
|
42
36
|
|
|
43
37
|
get onError(): SocketErrorHandler | null {
|
|
44
|
-
|
|
38
|
+
return this._socket!.onerror;
|
|
45
39
|
}
|
|
46
40
|
|
|
47
41
|
set onError(value: SocketErrorHandler | null) {
|
|
48
|
-
|
|
42
|
+
this._socket!.onerror = value;
|
|
49
43
|
}
|
|
50
44
|
|
|
51
45
|
get onMessage(): SocketMessageHandler | null {
|
|
52
|
-
|
|
46
|
+
return this._socket!.onmessage;
|
|
53
47
|
}
|
|
54
48
|
|
|
55
49
|
set onMessage(value: SocketMessageHandler | null) {
|
|
@@ -68,7 +62,8 @@ export class WebSocketAdapterPb implements WebSocketAdapter {
|
|
|
68
62
|
|
|
69
63
|
value!(envelope);
|
|
70
64
|
};
|
|
71
|
-
}
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
72
67
|
value = null;
|
|
73
68
|
}
|
|
74
69
|
}
|
|
@@ -111,9 +106,6 @@ export class WebSocketAdapterPb implements WebSocketAdapter {
|
|
|
111
106
|
)}&format=protobuf&platform=${encodeURIComponent(platform)}`;
|
|
112
107
|
this._socket = new WebSocket(url);
|
|
113
108
|
this._socket.binaryType = "arraybuffer";
|
|
114
|
-
this._pcRef = new RTCPeerConnection({
|
|
115
|
-
iceServers: [{ urls: "stun:stun.l.google.com:19302" }],
|
|
116
|
-
});
|
|
117
109
|
}
|
|
118
110
|
|
|
119
111
|
send(msg: any): void {
|
|
@@ -137,8 +129,4 @@ export class WebSocketAdapterPb implements WebSocketAdapter {
|
|
|
137
129
|
const encodedMsg = envelopeWriter.finish();
|
|
138
130
|
this._socket!.send(encodedMsg);
|
|
139
131
|
}
|
|
140
|
-
|
|
141
|
-
getRTCPeerConnection(): RTCPeerConnection {
|
|
142
|
-
return this._pcRef!;
|
|
143
|
-
}
|
|
144
132
|
}
|