mezon-js 2.9.74 → 2.9.76
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/mezon-js.cjs.js +25 -2
- package/dist/mezon-js.esm.mjs +25 -2
- package/dist/socket.d.ts +25 -4
- package/package.json +1 -1
- package/socket.ts +81 -4
package/dist/mezon-js.cjs.js
CHANGED
@@ -6818,6 +6818,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6818
6818
|
this.onmessagebuttonclicked(message.message_button_clicked);
|
6819
6819
|
} else if (message.webrtc_signaling_fwd) {
|
6820
6820
|
this.onwebrtcsignalingfwd(message.webrtc_signaling_fwd);
|
6821
|
+
} else if (message.list_activity) {
|
6822
|
+
this.onactivityupdated(message.list_activity);
|
6821
6823
|
} else {
|
6822
6824
|
if (this.verbose && window && window.console) {
|
6823
6825
|
console.log("Unrecognized message received: %o", message);
|
@@ -7105,6 +7107,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7105
7107
|
console.log(event);
|
7106
7108
|
}
|
7107
7109
|
}
|
7110
|
+
onactivityupdated(list_activity) {
|
7111
|
+
if (this.verbose && window && window.console) {
|
7112
|
+
console.log(list_activity);
|
7113
|
+
}
|
7114
|
+
}
|
7108
7115
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
7109
7116
|
const untypedMessage = message;
|
7110
7117
|
return new Promise((resolve, reject) => {
|
@@ -7351,10 +7358,10 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7351
7358
|
return response.check_name_existed_event;
|
7352
7359
|
});
|
7353
7360
|
}
|
7354
|
-
forwardWebrtcSignaling(receiver_id, data_type, json_data) {
|
7361
|
+
forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id) {
|
7355
7362
|
return __async(this, null, function* () {
|
7356
7363
|
const response = yield this.send({
|
7357
|
-
webrtc_signaling_fwd: { receiver_id, data_type, json_data }
|
7364
|
+
webrtc_signaling_fwd: { receiver_id, data_type, json_data, channel_id }
|
7358
7365
|
});
|
7359
7366
|
return response.webrtc_signaling_fwd;
|
7360
7367
|
});
|
@@ -7367,6 +7374,22 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7367
7374
|
return response.webrtc_signaling_fwd;
|
7368
7375
|
});
|
7369
7376
|
}
|
7377
|
+
joinPTTChannel(channelId, dataType, jsonData) {
|
7378
|
+
return __async(this, null, function* () {
|
7379
|
+
const response = yield this.send({
|
7380
|
+
join_ptt_channel: { channel_id: channelId, data_type: dataType, json_data: jsonData }
|
7381
|
+
});
|
7382
|
+
return response.join_ptt_channel;
|
7383
|
+
});
|
7384
|
+
}
|
7385
|
+
talkPTTChannel(channelId, dataType, jsonData, state) {
|
7386
|
+
return __async(this, null, function* () {
|
7387
|
+
const response = yield this.send({
|
7388
|
+
talk_ptt_channel: { channel_id: channelId, data_type: dataType, json_data: jsonData, state }
|
7389
|
+
});
|
7390
|
+
return response.talk_ptt_channel;
|
7391
|
+
});
|
7392
|
+
}
|
7370
7393
|
pingPong() {
|
7371
7394
|
return __async(this, null, function* () {
|
7372
7395
|
if (!this.adapter.isOpen()) {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -6788,6 +6788,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
6788
6788
|
this.onmessagebuttonclicked(message.message_button_clicked);
|
6789
6789
|
} else if (message.webrtc_signaling_fwd) {
|
6790
6790
|
this.onwebrtcsignalingfwd(message.webrtc_signaling_fwd);
|
6791
|
+
} else if (message.list_activity) {
|
6792
|
+
this.onactivityupdated(message.list_activity);
|
6791
6793
|
} else {
|
6792
6794
|
if (this.verbose && window && window.console) {
|
6793
6795
|
console.log("Unrecognized message received: %o", message);
|
@@ -7075,6 +7077,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7075
7077
|
console.log(event);
|
7076
7078
|
}
|
7077
7079
|
}
|
7080
|
+
onactivityupdated(list_activity) {
|
7081
|
+
if (this.verbose && window && window.console) {
|
7082
|
+
console.log(list_activity);
|
7083
|
+
}
|
7084
|
+
}
|
7078
7085
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
7079
7086
|
const untypedMessage = message;
|
7080
7087
|
return new Promise((resolve, reject) => {
|
@@ -7321,10 +7328,10 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7321
7328
|
return response.check_name_existed_event;
|
7322
7329
|
});
|
7323
7330
|
}
|
7324
|
-
forwardWebrtcSignaling(receiver_id, data_type, json_data) {
|
7331
|
+
forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id) {
|
7325
7332
|
return __async(this, null, function* () {
|
7326
7333
|
const response = yield this.send({
|
7327
|
-
webrtc_signaling_fwd: { receiver_id, data_type, json_data }
|
7334
|
+
webrtc_signaling_fwd: { receiver_id, data_type, json_data, channel_id }
|
7328
7335
|
});
|
7329
7336
|
return response.webrtc_signaling_fwd;
|
7330
7337
|
});
|
@@ -7337,6 +7344,22 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7337
7344
|
return response.webrtc_signaling_fwd;
|
7338
7345
|
});
|
7339
7346
|
}
|
7347
|
+
joinPTTChannel(channelId, dataType, jsonData) {
|
7348
|
+
return __async(this, null, function* () {
|
7349
|
+
const response = yield this.send({
|
7350
|
+
join_ptt_channel: { channel_id: channelId, data_type: dataType, json_data: jsonData }
|
7351
|
+
});
|
7352
|
+
return response.join_ptt_channel;
|
7353
|
+
});
|
7354
|
+
}
|
7355
|
+
talkPTTChannel(channelId, dataType, jsonData, state) {
|
7356
|
+
return __async(this, null, function* () {
|
7357
|
+
const response = yield this.send({
|
7358
|
+
talk_ptt_channel: { channel_id: channelId, data_type: dataType, json_data: jsonData, state }
|
7359
|
+
});
|
7360
|
+
return response.talk_ptt_channel;
|
7361
|
+
});
|
7362
|
+
}
|
7340
7363
|
pingPong() {
|
7341
7364
|
return __async(this, null, function* () {
|
7342
7365
|
if (!this.adapter.isOpen()) {
|
package/dist/socket.d.ts
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionUpdate, ApiRole, ApiRpc, ApiTokenSentEvent } from "./api.gen";
|
16
|
+
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionUpdate, ApiRole, ApiRpc, ApiTokenSentEvent, ApiUserActivity } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { ChannelMessage, Notification } from "./client";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -588,6 +588,21 @@ export interface WebrtcSignalingFwd {
|
|
588
588
|
receiver_id: string;
|
589
589
|
data_type: number;
|
590
590
|
json_data: string;
|
591
|
+
channel_id: string;
|
592
|
+
}
|
593
|
+
export interface JoinPTTChannel {
|
594
|
+
channel_id: string;
|
595
|
+
data_type: number;
|
596
|
+
json_data: string;
|
597
|
+
}
|
598
|
+
export interface TalkPTTChannel {
|
599
|
+
channel_id: string;
|
600
|
+
data_type: number;
|
601
|
+
json_data: string;
|
602
|
+
state: number;
|
603
|
+
}
|
604
|
+
export interface ListActivity {
|
605
|
+
acts: ApiUserActivity[];
|
591
606
|
}
|
592
607
|
/** A socket connection to Mezon server. */
|
593
608
|
export interface Socket {
|
@@ -631,6 +646,8 @@ export interface Socket {
|
|
631
646
|
writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
|
632
647
|
/** send voice leaved */
|
633
648
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
649
|
+
joinPTTChannel(channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
|
650
|
+
talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
|
634
651
|
/** Handle disconnect events received from the socket. */
|
635
652
|
ondisconnect: (evt: Event) => void;
|
636
653
|
/** Handle error events received from the socket. */
|
@@ -691,7 +708,7 @@ export interface Socket {
|
|
691
708
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
692
709
|
handleMessageButtonClick: (message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string) => Promise<MessageButtonClicked>;
|
693
710
|
onmessagebuttonclicked: (event: MessageButtonClicked) => void;
|
694
|
-
forwardWebrtcSignaling: (receiverId: string, dataType: number, jsonData: string) => Promise<WebrtcSignalingFwd>;
|
711
|
+
forwardWebrtcSignaling: (receiverId: string, dataType: number, jsonData: string, channelId: string) => Promise<WebrtcSignalingFwd>;
|
695
712
|
onwebrtcsignalingfwd: (event: WebrtcSignalingFwd) => void;
|
696
713
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
697
714
|
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
@@ -705,6 +722,7 @@ export interface Socket {
|
|
705
722
|
onpermissionchanged: (permission_changed_event: PermissionChangedEvent) => void;
|
706
723
|
onunmuteevent: (unmute_event: UnmuteEvent) => void;
|
707
724
|
ontokensent: (token: ApiTokenSentEvent) => void;
|
725
|
+
onactivityupdated: (list_activity: ListActivity) => void;
|
708
726
|
}
|
709
727
|
/** Reports an error received from a socket message. */
|
710
728
|
export interface SocketError {
|
@@ -781,7 +799,8 @@ export declare class DefaultSocket implements Socket {
|
|
781
799
|
ontokensent(tokenSentEvent: ApiTokenSentEvent): void;
|
782
800
|
onmessagebuttonclicked(messageButtonClicked: MessageButtonClicked): void;
|
783
801
|
onwebrtcsignalingfwd(event: WebrtcSignalingFwd): void;
|
784
|
-
|
802
|
+
onactivityupdated(list_activity: ListActivity): void;
|
803
|
+
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | MessageButtonClicked | JoinPTTChannel | TalkPTTChannel, sendTimeout?: number): Promise<any>;
|
785
804
|
followUsers(userIds: string[]): Promise<Status>;
|
786
805
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
787
806
|
joinChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<Channel>;
|
@@ -800,8 +819,10 @@ export declare class DefaultSocket implements Socket {
|
|
800
819
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
801
820
|
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
802
821
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
803
|
-
forwardWebrtcSignaling(receiver_id: string, data_type: number, json_data: string): Promise<WebrtcSignalingFwd>;
|
822
|
+
forwardWebrtcSignaling(receiver_id: string, data_type: number, json_data: string, channel_id: string): Promise<WebrtcSignalingFwd>;
|
804
823
|
handleMessageButtonClick(message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string): Promise<MessageButtonClicked>;
|
824
|
+
joinPTTChannel(channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
|
825
|
+
talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
|
805
826
|
private pingPong;
|
806
827
|
}
|
807
828
|
export {};
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -27,6 +27,7 @@ import {
|
|
27
27
|
ApiRole,
|
28
28
|
ApiRpc,
|
29
29
|
ApiTokenSentEvent,
|
30
|
+
ApiUserActivity,
|
30
31
|
} from "./api.gen";
|
31
32
|
import { Session } from "./session";
|
32
33
|
import { ChannelMessage, Notification } from "./client";
|
@@ -831,6 +832,31 @@ export interface WebrtcSignalingFwd {
|
|
831
832
|
receiver_id: string;
|
832
833
|
data_type: number;
|
833
834
|
json_data: string;
|
835
|
+
channel_id: string;
|
836
|
+
}
|
837
|
+
|
838
|
+
export interface JoinPTTChannel {
|
839
|
+
// channel id
|
840
|
+
channel_id: string;
|
841
|
+
// type offer, answer or candidate
|
842
|
+
data_type: number;
|
843
|
+
// offer
|
844
|
+
json_data: string;
|
845
|
+
}
|
846
|
+
|
847
|
+
export interface TalkPTTChannel {
|
848
|
+
// channel id
|
849
|
+
channel_id: string;
|
850
|
+
// type offer, answer or candidate
|
851
|
+
data_type: number;
|
852
|
+
// offer
|
853
|
+
json_data: string;
|
854
|
+
// start or end
|
855
|
+
state: number;
|
856
|
+
}
|
857
|
+
|
858
|
+
export interface ListActivity {
|
859
|
+
acts: ApiUserActivity[];
|
834
860
|
}
|
835
861
|
|
836
862
|
/** A socket connection to Mezon server. */
|
@@ -986,6 +1012,19 @@ export interface Socket {
|
|
986
1012
|
voiceUserId: string
|
987
1013
|
): Promise<VoiceLeavedEvent>;
|
988
1014
|
|
1015
|
+
joinPTTChannel(
|
1016
|
+
channelId: string,
|
1017
|
+
dataType: number,
|
1018
|
+
jsonData: string
|
1019
|
+
): Promise<JoinPTTChannel>;
|
1020
|
+
|
1021
|
+
talkPTTChannel(
|
1022
|
+
channelId: string,
|
1023
|
+
dataType: number,
|
1024
|
+
jsonData: string,
|
1025
|
+
state: number
|
1026
|
+
): Promise<TalkPTTChannel>;
|
1027
|
+
|
989
1028
|
/** Handle disconnect events received from the socket. */
|
990
1029
|
ondisconnect: (evt: Event) => void;
|
991
1030
|
|
@@ -1108,7 +1147,7 @@ export interface Socket {
|
|
1108
1147
|
|
1109
1148
|
onmessagebuttonclicked: (event: MessageButtonClicked) => void;
|
1110
1149
|
|
1111
|
-
forwardWebrtcSignaling: (receiverId: string, dataType: number, jsonData: string) => Promise<WebrtcSignalingFwd>;
|
1150
|
+
forwardWebrtcSignaling: (receiverId: string, dataType: number, jsonData: string, channelId: string) => Promise<WebrtcSignalingFwd>;
|
1112
1151
|
|
1113
1152
|
onwebrtcsignalingfwd: (event: WebrtcSignalingFwd) => void;
|
1114
1153
|
|
@@ -1143,6 +1182,8 @@ export interface Socket {
|
|
1143
1182
|
onunmuteevent: (unmute_event: UnmuteEvent) => void;
|
1144
1183
|
|
1145
1184
|
ontokensent: (token: ApiTokenSentEvent) => void;
|
1185
|
+
|
1186
|
+
onactivityupdated: (list_activity: ListActivity) => void;
|
1146
1187
|
}
|
1147
1188
|
|
1148
1189
|
/** Reports an error received from a socket message. */
|
@@ -1398,6 +1439,8 @@ export class DefaultSocket implements Socket {
|
|
1398
1439
|
this.onmessagebuttonclicked( <MessageButtonClicked>message.message_button_clicked);
|
1399
1440
|
} else if (message.webrtc_signaling_fwd) {
|
1400
1441
|
this.onwebrtcsignalingfwd(<WebrtcSignalingFwd>message.webrtc_signaling_fwd);
|
1442
|
+
} else if (message.list_activity){
|
1443
|
+
this.onactivityupdated(<ListActivity>message.list_activity);
|
1401
1444
|
} else {
|
1402
1445
|
if (this.verbose && window && window.console) {
|
1403
1446
|
console.log("Unrecognized message received: %o", message);
|
@@ -1741,6 +1784,11 @@ export class DefaultSocket implements Socket {
|
|
1741
1784
|
}
|
1742
1785
|
}
|
1743
1786
|
|
1787
|
+
onactivityupdated(list_activity: ListActivity) {
|
1788
|
+
if (this.verbose && window && window.console) {
|
1789
|
+
console.log(list_activity);
|
1790
|
+
}
|
1791
|
+
}
|
1744
1792
|
send(
|
1745
1793
|
message:
|
1746
1794
|
| ChannelJoin
|
@@ -1757,7 +1805,9 @@ export class DefaultSocket implements Socket {
|
|
1757
1805
|
| StatusUpdate
|
1758
1806
|
| Ping
|
1759
1807
|
| WebrtcSignalingFwd
|
1760
|
-
| MessageButtonClicked
|
1808
|
+
| MessageButtonClicked
|
1809
|
+
| JoinPTTChannel
|
1810
|
+
| TalkPTTChannel,
|
1761
1811
|
sendTimeout = DefaultSocket.DefaultSendTimeoutMs
|
1762
1812
|
): Promise<any> {
|
1763
1813
|
const untypedMessage = message as any;
|
@@ -2091,9 +2141,13 @@ export class DefaultSocket implements Socket {
|
|
2091
2141
|
return response.check_name_existed_event;
|
2092
2142
|
}
|
2093
2143
|
|
2094
|
-
async forwardWebrtcSignaling(
|
2144
|
+
async forwardWebrtcSignaling(
|
2145
|
+
receiver_id: string,
|
2146
|
+
data_type: number,
|
2147
|
+
json_data: string,
|
2148
|
+
channel_id: string): Promise<WebrtcSignalingFwd> {
|
2095
2149
|
const response = await this.send({
|
2096
|
-
webrtc_signaling_fwd: { receiver_id: receiver_id, data_type: data_type, json_data: json_data },
|
2150
|
+
webrtc_signaling_fwd: { receiver_id: receiver_id, data_type: data_type, json_data: json_data, channel_id: channel_id },
|
2097
2151
|
});
|
2098
2152
|
return response.webrtc_signaling_fwd;
|
2099
2153
|
}
|
@@ -2110,6 +2164,29 @@ export class DefaultSocket implements Socket {
|
|
2110
2164
|
return response.webrtc_signaling_fwd;
|
2111
2165
|
}
|
2112
2166
|
|
2167
|
+
async joinPTTChannel(
|
2168
|
+
channelId: string,
|
2169
|
+
dataType: number,
|
2170
|
+
jsonData: string
|
2171
|
+
): Promise<JoinPTTChannel> {
|
2172
|
+
const response = await this.send({
|
2173
|
+
join_ptt_channel: { channel_id: channelId, data_type: dataType, json_data: jsonData },
|
2174
|
+
});
|
2175
|
+
return response.join_ptt_channel;
|
2176
|
+
}
|
2177
|
+
|
2178
|
+
async talkPTTChannel(
|
2179
|
+
channelId: string,
|
2180
|
+
dataType: number,
|
2181
|
+
jsonData: string,
|
2182
|
+
state: number
|
2183
|
+
): Promise<TalkPTTChannel> {
|
2184
|
+
const response = await this.send({
|
2185
|
+
talk_ptt_channel: { channel_id: channelId, data_type: dataType, json_data: jsonData, state: state },
|
2186
|
+
});
|
2187
|
+
return response.talk_ptt_channel;
|
2188
|
+
}
|
2189
|
+
|
2113
2190
|
private async pingPong(): Promise<void> {
|
2114
2191
|
if (!this.adapter.isOpen()) {
|
2115
2192
|
return;
|