mezon-js 2.9.69 → 2.9.71
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/mezon-js.cjs.js +234 -64
- package/dist/mezon-js.esm.mjs +234 -64
- package/dist/socket.d.ts +14 -3
- package/dist/web_socket_adapter.d.ts +8 -0
- package/package.json +1 -1
- package/socket.ts +627 -227
- package/web_socket_adapter.ts +141 -102
package/dist/mezon-js.esm.mjs
CHANGED
@@ -6510,7 +6510,9 @@ var WebSocketAdapterText = class {
|
|
6510
6510
|
this._socket.onmessage = (evt) => {
|
6511
6511
|
const message = JSON.parse(evt.data);
|
6512
6512
|
if (message.party_data && message.party_data.data) {
|
6513
|
-
message.party_data.data = new Uint8Array(
|
6513
|
+
message.party_data.data = new Uint8Array(
|
6514
|
+
decode2(message.party_data.data)
|
6515
|
+
);
|
6514
6516
|
}
|
6515
6517
|
value(message);
|
6516
6518
|
};
|
@@ -6534,12 +6536,21 @@ var WebSocketAdapterText = class {
|
|
6534
6536
|
this.close();
|
6535
6537
|
});
|
6536
6538
|
}
|
6537
|
-
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(
|
6539
|
+
const url = `${scheme}${host}:${port}/ws?lang=en&status=${encodeURIComponent(
|
6540
|
+
createStatus.toString()
|
6541
|
+
)}&token=${encodeURIComponent(token)}&paltform=${encodeURIComponent(
|
6542
|
+
platform
|
6543
|
+
)}`;
|
6538
6544
|
this._socket = new WebSocket(url);
|
6545
|
+
this._pcRef = new RTCPeerConnection({
|
6546
|
+
iceServers: [{ urls: "stun:stun.l.google.com:19302" }]
|
6547
|
+
});
|
6539
6548
|
}
|
6540
6549
|
close() {
|
6541
|
-
var _a;
|
6542
|
-
(_a = this.
|
6550
|
+
var _a, _b;
|
6551
|
+
(_a = this._pcRef) == null ? void 0 : _a.close();
|
6552
|
+
this._pcRef = void 0;
|
6553
|
+
(_b = this._socket) == null ? void 0 : _b.close();
|
6543
6554
|
this._socket = void 0;
|
6544
6555
|
}
|
6545
6556
|
send(msg) {
|
@@ -6554,6 +6565,9 @@ var WebSocketAdapterText = class {
|
|
6554
6565
|
}
|
6555
6566
|
this._socket.send(JSON.stringify(msg));
|
6556
6567
|
}
|
6568
|
+
getRTCPeerConnection() {
|
6569
|
+
return this._pcRef;
|
6570
|
+
}
|
6557
6571
|
};
|
6558
6572
|
|
6559
6573
|
// socket.ts
|
@@ -6582,14 +6596,22 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6582
6596
|
return Promise.resolve(session);
|
6583
6597
|
}
|
6584
6598
|
const scheme = this.useSSL ? "wss://" : "ws://";
|
6585
|
-
this.adapter.connect(
|
6599
|
+
this.adapter.connect(
|
6600
|
+
scheme,
|
6601
|
+
this.host,
|
6602
|
+
this.port,
|
6603
|
+
createStatus,
|
6604
|
+
session.token,
|
6605
|
+
platform,
|
6606
|
+
signal
|
6607
|
+
);
|
6586
6608
|
this.adapter.onClose = (evt) => {
|
6587
6609
|
this.ondisconnect(evt);
|
6588
6610
|
};
|
6589
6611
|
this.adapter.onError = (evt) => {
|
6590
6612
|
this.onerror(evt);
|
6591
6613
|
};
|
6592
|
-
this.adapter.onMessage = (message) => {
|
6614
|
+
this.adapter.onMessage = (message) => __async(this, null, function* () {
|
6593
6615
|
if (this.verbose && window && window.console) {
|
6594
6616
|
console.log("Response: %o", JSON.stringify(message));
|
6595
6617
|
}
|
@@ -6632,9 +6654,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6632
6654
|
} else if (message.last_seen_message_event) {
|
6633
6655
|
this.onlastseenupdated(message.last_seen_message_event);
|
6634
6656
|
} else if (message.status_presence_event) {
|
6635
|
-
this.onstatuspresence(
|
6657
|
+
this.onstatuspresence(
|
6658
|
+
message.status_presence_event
|
6659
|
+
);
|
6636
6660
|
} else if (message.stream_presence_event) {
|
6637
|
-
this.onstreampresence(
|
6661
|
+
this.onstreampresence(
|
6662
|
+
message.stream_presence_event
|
6663
|
+
);
|
6638
6664
|
} else if (message.stream_data) {
|
6639
6665
|
this.onstreamdata(message.stream_data);
|
6640
6666
|
} else if (message.channel_message) {
|
@@ -6694,25 +6720,41 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6694
6720
|
};
|
6695
6721
|
this.onchannelmessage(e);
|
6696
6722
|
} else if (message.message_typing_event) {
|
6697
|
-
this.onmessagetyping(
|
6723
|
+
this.onmessagetyping(
|
6724
|
+
message.message_typing_event
|
6725
|
+
);
|
6698
6726
|
} else if (message.message_reaction_event) {
|
6699
|
-
this.onmessagereaction(
|
6727
|
+
this.onmessagereaction(
|
6728
|
+
message.message_reaction_event
|
6729
|
+
);
|
6700
6730
|
} else if (message.channel_presence_event) {
|
6701
|
-
this.onchannelpresence(
|
6731
|
+
this.onchannelpresence(
|
6732
|
+
message.channel_presence_event
|
6733
|
+
);
|
6702
6734
|
} else if (message.last_pin_message_event) {
|
6703
|
-
this.onpinmessage(
|
6735
|
+
this.onpinmessage(
|
6736
|
+
message.last_pin_message_event
|
6737
|
+
);
|
6704
6738
|
} else if (message.custom_status_event) {
|
6705
6739
|
this.oncustomstatus(message.custom_status_event);
|
6706
6740
|
} else if (message.user_channel_added_event) {
|
6707
|
-
this.onuserchanneladded(
|
6741
|
+
this.onuserchanneladded(
|
6742
|
+
message.user_channel_added_event
|
6743
|
+
);
|
6708
6744
|
} else if (message.add_clan_user_event) {
|
6709
6745
|
this.onuserclanadded(message.add_clan_user_event);
|
6710
6746
|
} else if (message.user_profile_updated_event) {
|
6711
|
-
this.onuserprofileupdate(
|
6747
|
+
this.onuserprofileupdate(
|
6748
|
+
message.user_profile_updated_event
|
6749
|
+
);
|
6712
6750
|
} else if (message.user_channel_removed_event) {
|
6713
|
-
this.onuserchannelremoved(
|
6751
|
+
this.onuserchannelremoved(
|
6752
|
+
message.user_channel_removed_event
|
6753
|
+
);
|
6714
6754
|
} else if (message.user_clan_removed_event) {
|
6715
|
-
this.onuserclanremoved(
|
6755
|
+
this.onuserclanremoved(
|
6756
|
+
message.user_clan_removed_event
|
6757
|
+
);
|
6716
6758
|
} else if (message.clan_event_created) {
|
6717
6759
|
this.oneventcreated(message.clan_event_created);
|
6718
6760
|
} else if (message.give_coffee_event) {
|
@@ -6720,23 +6762,35 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6720
6762
|
} else if (message.role_assign_event) {
|
6721
6763
|
this.onroleassign(message.role_assign_event);
|
6722
6764
|
} else if (message.streaming_started_event) {
|
6723
|
-
this.onstreamingchannelstarted(
|
6765
|
+
this.onstreamingchannelstarted(
|
6766
|
+
message.streaming_started_event
|
6767
|
+
);
|
6724
6768
|
} else if (message.streaming_ended_event) {
|
6725
|
-
this.onstreamingchannelended(
|
6769
|
+
this.onstreamingchannelended(
|
6770
|
+
message.streaming_ended_event
|
6771
|
+
);
|
6726
6772
|
} else if (message.streaming_joined_event) {
|
6727
|
-
this.onstreamingchanneljoined(
|
6773
|
+
this.onstreamingchanneljoined(
|
6774
|
+
message.streaming_joined_event
|
6775
|
+
);
|
6728
6776
|
} else if (message.streaming_leaved_event) {
|
6729
|
-
this.onstreamingchannelleaved(
|
6777
|
+
this.onstreamingchannelleaved(
|
6778
|
+
message.streaming_leaved_event
|
6779
|
+
);
|
6730
6780
|
} else if (message.permission_set_event) {
|
6731
6781
|
this.onpermissionset(message.permission_set_event);
|
6732
6782
|
} else if (message.permission_changed_event) {
|
6733
|
-
this.onpermissionchanged(
|
6783
|
+
this.onpermissionchanged(
|
6784
|
+
message.permission_changed_event
|
6785
|
+
);
|
6734
6786
|
} else if (message.unmute_event) {
|
6735
6787
|
this.onunmuteevent(message.unmute_event);
|
6736
6788
|
} else if (message.token_sent_event) {
|
6737
6789
|
this.ontokensent(message.token_sent_event);
|
6738
6790
|
} else if (message.message_button_clicked) {
|
6739
|
-
this.
|
6791
|
+
this.onmessagebuttonclicked(message.message_button_clicked);
|
6792
|
+
} else if (message.webrtc_signaling_fwd) {
|
6793
|
+
this.onwebrtcsignalingfwd(message.webrtc_signaling_fwd);
|
6740
6794
|
} else {
|
6741
6795
|
if (this.verbose && window && window.console) {
|
6742
6796
|
console.log("Unrecognized message received: %o", message);
|
@@ -6757,7 +6811,7 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6757
6811
|
executor.resolve(message);
|
6758
6812
|
}
|
6759
6813
|
}
|
6760
|
-
};
|
6814
|
+
});
|
6761
6815
|
return new Promise((resolve, reject) => {
|
6762
6816
|
this.adapter.onOpen = (evt) => {
|
6763
6817
|
if (this.verbose && window && window.console) {
|
@@ -7014,11 +7068,16 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7014
7068
|
console.log(tokenSentEvent);
|
7015
7069
|
}
|
7016
7070
|
}
|
7017
|
-
|
7071
|
+
onmessagebuttonclicked(messageButtonClicked) {
|
7018
7072
|
if (this.verbose && window && window.console) {
|
7019
7073
|
console.log(messageButtonClicked);
|
7020
7074
|
}
|
7021
7075
|
}
|
7076
|
+
onwebrtcsignalingfwd(event) {
|
7077
|
+
if (this.verbose && window && window.console) {
|
7078
|
+
console.log(event);
|
7079
|
+
}
|
7080
|
+
}
|
7022
7081
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
7023
7082
|
const untypedMessage = message;
|
7024
7083
|
return new Promise((resolve, reject) => {
|
@@ -7026,9 +7085,13 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7026
7085
|
reject("Socket connection has not been established yet.");
|
7027
7086
|
} else {
|
7028
7087
|
if (untypedMessage.channel_message_send) {
|
7029
|
-
untypedMessage.channel_message_send.content = JSON.stringify(
|
7088
|
+
untypedMessage.channel_message_send.content = JSON.stringify(
|
7089
|
+
untypedMessage.channel_message_send.content
|
7090
|
+
);
|
7030
7091
|
} else if (untypedMessage.channel_message_update) {
|
7031
|
-
untypedMessage.channel_message_update.content = JSON.stringify(
|
7092
|
+
untypedMessage.channel_message_update.content = JSON.stringify(
|
7093
|
+
untypedMessage.channel_message_update.content
|
7094
|
+
);
|
7032
7095
|
}
|
7033
7096
|
const cid = this.generatecid();
|
7034
7097
|
this.cIds[cid] = { resolve, reject };
|
@@ -7058,49 +7121,50 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7058
7121
|
}
|
7059
7122
|
joinChat(clan_id, channel_id, channel_type, is_public) {
|
7060
7123
|
return __async(this, null, function* () {
|
7061
|
-
const response = yield this.send(
|
7062
|
-
{
|
7063
|
-
|
7064
|
-
|
7065
|
-
|
7066
|
-
|
7067
|
-
is_public
|
7068
|
-
}
|
7124
|
+
const response = yield this.send({
|
7125
|
+
channel_join: {
|
7126
|
+
clan_id,
|
7127
|
+
channel_id,
|
7128
|
+
channel_type,
|
7129
|
+
is_public
|
7069
7130
|
}
|
7070
|
-
);
|
7131
|
+
});
|
7071
7132
|
return response.channel;
|
7072
7133
|
});
|
7073
7134
|
}
|
7074
7135
|
leaveChat(clan_id, channel_id, channel_type, is_public) {
|
7075
|
-
return this.send({
|
7136
|
+
return this.send({
|
7137
|
+
channel_leave: {
|
7138
|
+
clan_id,
|
7139
|
+
channel_id,
|
7140
|
+
channel_type,
|
7141
|
+
is_public
|
7142
|
+
}
|
7143
|
+
});
|
7076
7144
|
}
|
7077
7145
|
removeChatMessage(clan_id, channel_id, mode, is_public, message_id) {
|
7078
7146
|
return __async(this, null, function* () {
|
7079
|
-
const response = yield this.send(
|
7080
|
-
{
|
7081
|
-
|
7082
|
-
|
7083
|
-
|
7084
|
-
|
7085
|
-
|
7086
|
-
is_public
|
7087
|
-
}
|
7147
|
+
const response = yield this.send({
|
7148
|
+
channel_message_remove: {
|
7149
|
+
clan_id,
|
7150
|
+
channel_id,
|
7151
|
+
mode,
|
7152
|
+
message_id,
|
7153
|
+
is_public
|
7088
7154
|
}
|
7089
|
-
);
|
7155
|
+
});
|
7090
7156
|
return response.channel_message_ack;
|
7091
7157
|
});
|
7092
7158
|
}
|
7093
7159
|
rpc(id, payload, http_key) {
|
7094
7160
|
return __async(this, null, function* () {
|
7095
|
-
const response = yield this.send(
|
7096
|
-
{
|
7097
|
-
|
7098
|
-
|
7099
|
-
|
7100
|
-
http_key
|
7101
|
-
}
|
7161
|
+
const response = yield this.send({
|
7162
|
+
rpc: {
|
7163
|
+
id,
|
7164
|
+
payload,
|
7165
|
+
http_key
|
7102
7166
|
}
|
7103
|
-
);
|
7167
|
+
});
|
7104
7168
|
return response.rpc;
|
7105
7169
|
});
|
7106
7170
|
}
|
@@ -7109,7 +7173,19 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7109
7173
|
}
|
7110
7174
|
updateChatMessage(clan_id, channel_id, mode, is_public, message_id, content, mentions, attachments, hideEditted) {
|
7111
7175
|
return __async(this, null, function* () {
|
7112
|
-
const response = yield this.send({
|
7176
|
+
const response = yield this.send({
|
7177
|
+
channel_message_update: {
|
7178
|
+
clan_id,
|
7179
|
+
channel_id,
|
7180
|
+
message_id,
|
7181
|
+
content,
|
7182
|
+
mentions,
|
7183
|
+
attachments,
|
7184
|
+
mode,
|
7185
|
+
is_public,
|
7186
|
+
hide_editted: hideEditted
|
7187
|
+
}
|
7188
|
+
});
|
7113
7189
|
return response.channel_message_ack;
|
7114
7190
|
});
|
7115
7191
|
}
|
@@ -7118,58 +7194,152 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7118
7194
|
}
|
7119
7195
|
writeChatMessage(clan_id, channel_id, mode, is_public, content, mentions, attachments, references, anonymous_message, mention_everyone, avatar) {
|
7120
7196
|
return __async(this, null, function* () {
|
7121
|
-
const response = yield this.send({
|
7197
|
+
const response = yield this.send({
|
7198
|
+
channel_message_send: {
|
7199
|
+
clan_id,
|
7200
|
+
channel_id,
|
7201
|
+
mode,
|
7202
|
+
is_public,
|
7203
|
+
content,
|
7204
|
+
mentions,
|
7205
|
+
attachments,
|
7206
|
+
references,
|
7207
|
+
anonymous_message,
|
7208
|
+
mention_everyone,
|
7209
|
+
avatar
|
7210
|
+
}
|
7211
|
+
});
|
7122
7212
|
return response.channel_message_ack;
|
7123
7213
|
});
|
7124
7214
|
}
|
7125
7215
|
writeMessageReaction(id, clan_id, channel_id, mode, is_public, message_id, emoji_id, emoji, count, message_sender_id, action_delete) {
|
7126
7216
|
return __async(this, null, function* () {
|
7127
|
-
const response = yield this.send({
|
7217
|
+
const response = yield this.send({
|
7218
|
+
message_reaction_event: {
|
7219
|
+
id,
|
7220
|
+
clan_id,
|
7221
|
+
channel_id,
|
7222
|
+
mode,
|
7223
|
+
is_public,
|
7224
|
+
message_id,
|
7225
|
+
emoji_id,
|
7226
|
+
emoji,
|
7227
|
+
count,
|
7228
|
+
message_sender_id,
|
7229
|
+
action: action_delete
|
7230
|
+
}
|
7231
|
+
});
|
7128
7232
|
return response.message_reaction_event;
|
7129
7233
|
});
|
7130
7234
|
}
|
7131
7235
|
writeMessageTyping(clan_id, channel_id, mode, is_public) {
|
7132
7236
|
return __async(this, null, function* () {
|
7133
|
-
const response = yield this.send({
|
7237
|
+
const response = yield this.send({
|
7238
|
+
message_typing_event: {
|
7239
|
+
clan_id,
|
7240
|
+
channel_id,
|
7241
|
+
mode,
|
7242
|
+
is_public
|
7243
|
+
}
|
7244
|
+
});
|
7134
7245
|
return response.message_typing_event;
|
7135
7246
|
});
|
7136
7247
|
}
|
7137
7248
|
writeLastSeenMessage(clan_id, channel_id, mode, message_id, timestamp_seconds) {
|
7138
7249
|
return __async(this, null, function* () {
|
7139
|
-
const response = yield this.send({
|
7250
|
+
const response = yield this.send({
|
7251
|
+
last_seen_message_event: {
|
7252
|
+
clan_id,
|
7253
|
+
channel_id,
|
7254
|
+
mode,
|
7255
|
+
message_id,
|
7256
|
+
timestamp_seconds
|
7257
|
+
}
|
7258
|
+
});
|
7140
7259
|
return response.last_seen_message_event;
|
7141
7260
|
});
|
7142
7261
|
}
|
7143
7262
|
writeLastPinMessage(clan_id, channel_id, mode, is_public, message_id, timestamp_seconds, operation) {
|
7144
7263
|
return __async(this, null, function* () {
|
7145
|
-
const response = yield this.send({
|
7264
|
+
const response = yield this.send({
|
7265
|
+
last_pin_message_event: {
|
7266
|
+
clan_id,
|
7267
|
+
channel_id,
|
7268
|
+
mode,
|
7269
|
+
is_public,
|
7270
|
+
message_id,
|
7271
|
+
timestamp_seconds,
|
7272
|
+
operation
|
7273
|
+
}
|
7274
|
+
});
|
7146
7275
|
return response.last_pin_message_event;
|
7147
7276
|
});
|
7148
7277
|
}
|
7149
7278
|
writeVoiceJoined(id, clanId, clanName, voiceChannelId, voiceChannelLabel, participant, lastScreenshot) {
|
7150
7279
|
return __async(this, null, function* () {
|
7151
|
-
const response = yield this.send({
|
7280
|
+
const response = yield this.send({
|
7281
|
+
voice_joined_event: {
|
7282
|
+
clan_id: clanId,
|
7283
|
+
clan_name: clanName,
|
7284
|
+
id,
|
7285
|
+
participant,
|
7286
|
+
voice_channel_id: voiceChannelId,
|
7287
|
+
voice_channel_label: voiceChannelLabel,
|
7288
|
+
last_screenshot: lastScreenshot
|
7289
|
+
}
|
7290
|
+
});
|
7152
7291
|
return response.voice_joined_event;
|
7153
7292
|
});
|
7154
7293
|
}
|
7155
7294
|
writeVoiceLeaved(id, clanId, voiceChannelId, voiceUserId) {
|
7156
7295
|
return __async(this, null, function* () {
|
7157
|
-
const response = yield this.send({
|
7296
|
+
const response = yield this.send({
|
7297
|
+
voice_leaved_event: {
|
7298
|
+
id,
|
7299
|
+
clan_id: clanId,
|
7300
|
+
voice_channel_id: voiceChannelId,
|
7301
|
+
voice_user_id: voiceUserId
|
7302
|
+
}
|
7303
|
+
});
|
7158
7304
|
return response.voice_leaved_event;
|
7159
7305
|
});
|
7160
7306
|
}
|
7161
7307
|
writeCustomStatus(clan_id, status) {
|
7162
7308
|
return __async(this, null, function* () {
|
7163
|
-
const response = yield this.send({
|
7309
|
+
const response = yield this.send({
|
7310
|
+
custom_status_event: { clan_id, status }
|
7311
|
+
});
|
7164
7312
|
return response.custom_status_event;
|
7165
7313
|
});
|
7166
7314
|
}
|
7167
7315
|
checkDuplicateName(name, condition_id, type) {
|
7168
7316
|
return __async(this, null, function* () {
|
7169
|
-
const response = yield this.send({
|
7317
|
+
const response = yield this.send({
|
7318
|
+
check_name_existed_event: {
|
7319
|
+
name,
|
7320
|
+
condition_id,
|
7321
|
+
type
|
7322
|
+
}
|
7323
|
+
});
|
7170
7324
|
return response.check_name_existed_event;
|
7171
7325
|
});
|
7172
7326
|
}
|
7327
|
+
forwardWebrtcSignaling(receiver_id, data_type, json_data) {
|
7328
|
+
return __async(this, null, function* () {
|
7329
|
+
const response = yield this.send({
|
7330
|
+
webrtc_signaling_fwd: { receiver_id, data_type, json_data }
|
7331
|
+
});
|
7332
|
+
return response.webrtc_signaling_fwd;
|
7333
|
+
});
|
7334
|
+
}
|
7335
|
+
handleMessageButtonClick(message_id, channel_id, button_id, sender_id, user_id) {
|
7336
|
+
return __async(this, null, function* () {
|
7337
|
+
const response = yield this.send({
|
7338
|
+
message_button_clicked: { message_id, channel_id, button_id, sender_id, user_id }
|
7339
|
+
});
|
7340
|
+
return response.webrtc_signaling_fwd;
|
7341
|
+
});
|
7342
|
+
}
|
7173
7343
|
pingPong() {
|
7174
7344
|
return __async(this, null, function* () {
|
7175
7345
|
if (!this.adapter.isOpen()) {
|
package/dist/socket.d.ts
CHANGED
@@ -584,6 +584,11 @@ export interface MessageButtonClicked {
|
|
584
584
|
sender_id: string;
|
585
585
|
user_id: string;
|
586
586
|
}
|
587
|
+
export interface WebrtcSignalingFwd {
|
588
|
+
receiverId: string;
|
589
|
+
dataType: number;
|
590
|
+
jsonData: string;
|
591
|
+
}
|
587
592
|
/** A socket connection to Mezon server. */
|
588
593
|
export interface Socket {
|
589
594
|
/** Connection is Open */
|
@@ -684,7 +689,10 @@ export interface Socket {
|
|
684
689
|
setHeartbeatTimeoutMs(ms: number): void;
|
685
690
|
getHeartbeatTimeoutMs(): number;
|
686
691
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
687
|
-
handleMessageButtonClick: (
|
692
|
+
handleMessageButtonClick: (message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string) => Promise<MessageButtonClicked>;
|
693
|
+
onmessagebuttonclicked: (event: MessageButtonClicked) => void;
|
694
|
+
forwardWebrtcSignaling: (receiverId: string, dataType: number, jsonData: string) => Promise<WebrtcSignalingFwd>;
|
695
|
+
onwebrtcsignalingfwd: (event: WebrtcSignalingFwd) => void;
|
688
696
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
689
697
|
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
690
698
|
oneventemoji: (event_emoji: EventEmoji) => void;
|
@@ -771,8 +779,9 @@ export declare class DefaultSocket implements Socket {
|
|
771
779
|
onpermissionchanged(permission_changed_event: PermissionChangedEvent): void;
|
772
780
|
onunmuteevent(unmute_event: UnmuteEvent): void;
|
773
781
|
ontokensent(tokenSentEvent: ApiTokenSentEvent): void;
|
774
|
-
|
775
|
-
|
782
|
+
onmessagebuttonclicked(messageButtonClicked: MessageButtonClicked): void;
|
783
|
+
onwebrtcsignalingfwd(event: WebrtcSignalingFwd): void;
|
784
|
+
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | MessageButtonClicked, sendTimeout?: number): Promise<any>;
|
776
785
|
followUsers(userIds: string[]): Promise<Status>;
|
777
786
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
778
787
|
joinChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<Channel>;
|
@@ -791,6 +800,8 @@ export declare class DefaultSocket implements Socket {
|
|
791
800
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
792
801
|
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
793
802
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
803
|
+
forwardWebrtcSignaling(receiver_id: string, data_type: number, json_data: string): Promise<WebrtcSignalingFwd>;
|
804
|
+
handleMessageButtonClick(message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string): Promise<MessageButtonClicked>;
|
794
805
|
private pingPong;
|
795
806
|
}
|
796
807
|
export {};
|
@@ -63,11 +63,18 @@ export interface SocketMessageHandler {
|
|
63
63
|
export interface SocketOpenHandler {
|
64
64
|
(this: WebSocket, evt: Event): void;
|
65
65
|
}
|
66
|
+
export interface RTCPeerOntrackHandler {
|
67
|
+
(this: RTCPeerConnection, ev: RTCTrackEvent): any | null;
|
68
|
+
}
|
69
|
+
export interface RTCPeerOnicecandidateHandler {
|
70
|
+
(this: RTCPeerConnection, ev: RTCPeerConnectionIceEvent): any;
|
71
|
+
}
|
66
72
|
/**
|
67
73
|
* A text-based socket adapter that accepts and transmits payloads over UTF-8.
|
68
74
|
*/
|
69
75
|
export declare class WebSocketAdapterText implements WebSocketAdapter {
|
70
76
|
private _socket?;
|
77
|
+
private _pcRef?;
|
71
78
|
get onClose(): SocketCloseHandler | null;
|
72
79
|
set onClose(value: SocketCloseHandler | null);
|
73
80
|
get onError(): SocketErrorHandler | null;
|
@@ -80,4 +87,5 @@ export declare class WebSocketAdapterText implements WebSocketAdapter {
|
|
80
87
|
connect(scheme: string, host: string, port: string, createStatus: boolean, token: string, platform: string, signal?: AbortSignal): void;
|
81
88
|
close(): void;
|
82
89
|
send(msg: any): void;
|
90
|
+
getRTCPeerConnection(): RTCPeerConnection;
|
83
91
|
}
|