mezon-js 2.9.74 → 2.9.75
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.
- package/dist/mezon-js.cjs.js +23 -0
- package/dist/mezon-js.esm.mjs +23 -0
- package/dist/socket.d.ts +22 -2
- package/package.json +1 -1
- package/socket.ts +77 -2
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) => {
|
@@ -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) => {
|
@@ -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";
|
@@ -589,6 +589,20 @@ export interface WebrtcSignalingFwd {
|
|
589
589
|
data_type: number;
|
590
590
|
json_data: string;
|
591
591
|
}
|
592
|
+
export interface JoinPTTChannel {
|
593
|
+
channel_id: string;
|
594
|
+
data_type: number;
|
595
|
+
json_data: string;
|
596
|
+
}
|
597
|
+
export interface TalkPTTChannel {
|
598
|
+
channel_id: string;
|
599
|
+
data_type: number;
|
600
|
+
json_data: string;
|
601
|
+
state: number;
|
602
|
+
}
|
603
|
+
export interface ListActivity {
|
604
|
+
acts: ApiUserActivity[];
|
605
|
+
}
|
592
606
|
/** A socket connection to Mezon server. */
|
593
607
|
export interface Socket {
|
594
608
|
/** Connection is Open */
|
@@ -631,6 +645,8 @@ export interface Socket {
|
|
631
645
|
writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
|
632
646
|
/** send voice leaved */
|
633
647
|
writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
|
648
|
+
joinPTTChannel(channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
|
649
|
+
talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
|
634
650
|
/** Handle disconnect events received from the socket. */
|
635
651
|
ondisconnect: (evt: Event) => void;
|
636
652
|
/** Handle error events received from the socket. */
|
@@ -705,6 +721,7 @@ export interface Socket {
|
|
705
721
|
onpermissionchanged: (permission_changed_event: PermissionChangedEvent) => void;
|
706
722
|
onunmuteevent: (unmute_event: UnmuteEvent) => void;
|
707
723
|
ontokensent: (token: ApiTokenSentEvent) => void;
|
724
|
+
onactivityupdated: (list_activity: ListActivity) => void;
|
708
725
|
}
|
709
726
|
/** Reports an error received from a socket message. */
|
710
727
|
export interface SocketError {
|
@@ -781,7 +798,8 @@ export declare class DefaultSocket implements Socket {
|
|
781
798
|
ontokensent(tokenSentEvent: ApiTokenSentEvent): void;
|
782
799
|
onmessagebuttonclicked(messageButtonClicked: MessageButtonClicked): void;
|
783
800
|
onwebrtcsignalingfwd(event: WebrtcSignalingFwd): void;
|
784
|
-
|
801
|
+
onactivityupdated(list_activity: ListActivity): void;
|
802
|
+
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | MessageButtonClicked | JoinPTTChannel | TalkPTTChannel, sendTimeout?: number): Promise<any>;
|
785
803
|
followUsers(userIds: string[]): Promise<Status>;
|
786
804
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
787
805
|
joinChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<Channel>;
|
@@ -802,6 +820,8 @@ export declare class DefaultSocket implements Socket {
|
|
802
820
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
803
821
|
forwardWebrtcSignaling(receiver_id: string, data_type: number, json_data: string): Promise<WebrtcSignalingFwd>;
|
804
822
|
handleMessageButtonClick(message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string): Promise<MessageButtonClicked>;
|
823
|
+
joinPTTChannel(channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
|
824
|
+
talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
|
805
825
|
private pingPong;
|
806
826
|
}
|
807
827
|
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";
|
@@ -833,6 +834,30 @@ export interface WebrtcSignalingFwd {
|
|
833
834
|
json_data: string;
|
834
835
|
}
|
835
836
|
|
837
|
+
export interface JoinPTTChannel {
|
838
|
+
// channel id
|
839
|
+
channel_id: string;
|
840
|
+
// type offer, answer or candidate
|
841
|
+
data_type: number;
|
842
|
+
// offer
|
843
|
+
json_data: string;
|
844
|
+
}
|
845
|
+
|
846
|
+
export interface TalkPTTChannel {
|
847
|
+
// channel id
|
848
|
+
channel_id: string;
|
849
|
+
// type offer, answer or candidate
|
850
|
+
data_type: number;
|
851
|
+
// offer
|
852
|
+
json_data: string;
|
853
|
+
// start or end
|
854
|
+
state: number;
|
855
|
+
}
|
856
|
+
|
857
|
+
export interface ListActivity {
|
858
|
+
acts: ApiUserActivity[];
|
859
|
+
}
|
860
|
+
|
836
861
|
/** A socket connection to Mezon server. */
|
837
862
|
export interface Socket {
|
838
863
|
/** Connection is Open */
|
@@ -986,6 +1011,19 @@ export interface Socket {
|
|
986
1011
|
voiceUserId: string
|
987
1012
|
): Promise<VoiceLeavedEvent>;
|
988
1013
|
|
1014
|
+
joinPTTChannel(
|
1015
|
+
channelId: string,
|
1016
|
+
dataType: number,
|
1017
|
+
jsonData: string
|
1018
|
+
): Promise<JoinPTTChannel>;
|
1019
|
+
|
1020
|
+
talkPTTChannel(
|
1021
|
+
channelId: string,
|
1022
|
+
dataType: number,
|
1023
|
+
jsonData: string,
|
1024
|
+
state: number
|
1025
|
+
): Promise<TalkPTTChannel>;
|
1026
|
+
|
989
1027
|
/** Handle disconnect events received from the socket. */
|
990
1028
|
ondisconnect: (evt: Event) => void;
|
991
1029
|
|
@@ -1143,6 +1181,8 @@ export interface Socket {
|
|
1143
1181
|
onunmuteevent: (unmute_event: UnmuteEvent) => void;
|
1144
1182
|
|
1145
1183
|
ontokensent: (token: ApiTokenSentEvent) => void;
|
1184
|
+
|
1185
|
+
onactivityupdated: (list_activity: ListActivity) => void;
|
1146
1186
|
}
|
1147
1187
|
|
1148
1188
|
/** Reports an error received from a socket message. */
|
@@ -1398,6 +1438,8 @@ export class DefaultSocket implements Socket {
|
|
1398
1438
|
this.onmessagebuttonclicked( <MessageButtonClicked>message.message_button_clicked);
|
1399
1439
|
} else if (message.webrtc_signaling_fwd) {
|
1400
1440
|
this.onwebrtcsignalingfwd(<WebrtcSignalingFwd>message.webrtc_signaling_fwd);
|
1441
|
+
} else if (message.list_activity){
|
1442
|
+
this.onactivityupdated(<ListActivity>message.list_activity);
|
1401
1443
|
} else {
|
1402
1444
|
if (this.verbose && window && window.console) {
|
1403
1445
|
console.log("Unrecognized message received: %o", message);
|
@@ -1741,6 +1783,11 @@ export class DefaultSocket implements Socket {
|
|
1741
1783
|
}
|
1742
1784
|
}
|
1743
1785
|
|
1786
|
+
onactivityupdated(list_activity: ListActivity) {
|
1787
|
+
if (this.verbose && window && window.console) {
|
1788
|
+
console.log(list_activity);
|
1789
|
+
}
|
1790
|
+
}
|
1744
1791
|
send(
|
1745
1792
|
message:
|
1746
1793
|
| ChannelJoin
|
@@ -1757,7 +1804,9 @@ export class DefaultSocket implements Socket {
|
|
1757
1804
|
| StatusUpdate
|
1758
1805
|
| Ping
|
1759
1806
|
| WebrtcSignalingFwd
|
1760
|
-
| MessageButtonClicked
|
1807
|
+
| MessageButtonClicked
|
1808
|
+
| JoinPTTChannel
|
1809
|
+
| TalkPTTChannel,
|
1761
1810
|
sendTimeout = DefaultSocket.DefaultSendTimeoutMs
|
1762
1811
|
): Promise<any> {
|
1763
1812
|
const untypedMessage = message as any;
|
@@ -2091,7 +2140,10 @@ export class DefaultSocket implements Socket {
|
|
2091
2140
|
return response.check_name_existed_event;
|
2092
2141
|
}
|
2093
2142
|
|
2094
|
-
async forwardWebrtcSignaling(
|
2143
|
+
async forwardWebrtcSignaling(
|
2144
|
+
receiver_id: string,
|
2145
|
+
data_type: number,
|
2146
|
+
json_data: string): Promise<WebrtcSignalingFwd> {
|
2095
2147
|
const response = await this.send({
|
2096
2148
|
webrtc_signaling_fwd: { receiver_id: receiver_id, data_type: data_type, json_data: json_data },
|
2097
2149
|
});
|
@@ -2110,6 +2162,29 @@ export class DefaultSocket implements Socket {
|
|
2110
2162
|
return response.webrtc_signaling_fwd;
|
2111
2163
|
}
|
2112
2164
|
|
2165
|
+
async joinPTTChannel(
|
2166
|
+
channelId: string,
|
2167
|
+
dataType: number,
|
2168
|
+
jsonData: string
|
2169
|
+
): Promise<JoinPTTChannel> {
|
2170
|
+
const response = await this.send({
|
2171
|
+
join_ptt_channel: { channel_id: channelId, data_type: dataType, json_data: jsonData },
|
2172
|
+
});
|
2173
|
+
return response.join_ptt_channel;
|
2174
|
+
}
|
2175
|
+
|
2176
|
+
async talkPTTChannel(
|
2177
|
+
channelId: string,
|
2178
|
+
dataType: number,
|
2179
|
+
jsonData: string,
|
2180
|
+
state: number
|
2181
|
+
): Promise<TalkPTTChannel> {
|
2182
|
+
const response = await this.send({
|
2183
|
+
talk_ptt_channel: { channel_id: channelId, data_type: dataType, json_data: jsonData, state: state },
|
2184
|
+
});
|
2185
|
+
return response.talk_ptt_channel;
|
2186
|
+
}
|
2187
|
+
|
2113
2188
|
private async pingPong(): Promise<void> {
|
2114
2189
|
if (!this.adapter.isOpen()) {
|
2115
2190
|
return;
|