rapido-fca 0.0.1 → 0.0.3

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.
Files changed (79) hide show
  1. package/package.json +1 -1
  2. package/readme.md +39 -237
  3. package/src/addExternalModule.js +23 -19
  4. package/src/addUserToGroup.js +97 -99
  5. package/src/changeAdminStatus.js +62 -86
  6. package/src/changeArchivedStatus.js +49 -49
  7. package/src/changeAvatar.js +108 -118
  8. package/src/changeBio.js +64 -63
  9. package/src/changeBlockedStatus.js +38 -40
  10. package/src/changeGroupImage.js +126 -129
  11. package/src/changeNickname.js +49 -49
  12. package/src/changeThreadColor.js +53 -53
  13. package/src/changeThreadEmoji.js +45 -45
  14. package/src/createNewGroup.js +72 -74
  15. package/src/createPoll.js +59 -59
  16. package/src/deleteMessage.js +50 -50
  17. package/src/deleteThread.js +50 -50
  18. package/src/editMessage.js +49 -51
  19. package/src/forwardAttachment.js +54 -54
  20. package/src/getCurrentUserID.js +3 -3
  21. package/src/getEmojiUrl.js +17 -17
  22. package/src/getFriendsList.js +67 -67
  23. package/src/getMessage.js +767 -806
  24. package/src/getThreadHistory.js +642 -656
  25. package/src/getThreadInfo.js +1 -1
  26. package/src/getThreadList.js +227 -199
  27. package/src/getThreadPictures.js +71 -51
  28. package/src/getUserID.js +58 -53
  29. package/src/getUserInfo.js +60 -52
  30. package/src/handleFriendRequest.js +65 -41
  31. package/src/handleMessageRequest.js +60 -42
  32. package/src/httpGet.js +57 -49
  33. package/src/httpPost.js +57 -48
  34. package/src/httpPostFormData.js +63 -0
  35. package/src/listenMqtt.js +895 -827
  36. package/src/logout.js +61 -61
  37. package/src/markAsDelivered.js +53 -42
  38. package/src/markAsRead.js +69 -59
  39. package/src/markAsReadAll.js +42 -32
  40. package/src/markAsSeen.js +54 -43
  41. package/src/muteThread.js +47 -40
  42. package/src/refreshFb_dtsg.js +69 -77
  43. package/src/removeUserFromGroup.js +67 -67
  44. package/src/resolvePhotoUrl.js +34 -34
  45. package/src/searchForThread.js +43 -43
  46. package/src/sendMessage.js +228 -80
  47. package/src/sendTypingIndicator.js +88 -86
  48. package/src/setMessageReaction.js +109 -110
  49. package/src/setPostReaction.js +87 -90
  50. package/src/setTitle.js +72 -76
  51. package/src/threadColors.js +121 -121
  52. package/src/unfriend.js +43 -43
  53. package/src/unsendMessage.js +38 -34
  54. package/src/uploadAttachment.js +81 -79
  55. package/src/changeAvatarV2.js +0 -86
  56. package/src/changeAvt.js +0 -85
  57. package/src/changeBlockedStatusMqtt.js +0 -80
  58. package/src/changeCover.js +0 -72
  59. package/src/changeName.js +0 -79
  60. package/src/changeUsername.js +0 -59
  61. package/src/createCommentPost.js +0 -230
  62. package/src/createPost.js +0 -276
  63. package/src/editMessageOld.js +0 -67
  64. package/src/follow.js +0 -74
  65. package/src/getAccess.js +0 -112
  66. package/src/getAvatarUser.js +0 -78
  67. package/src/getRegion.js +0 -7
  68. package/src/getThreadHistoryDeprecated.js +0 -71
  69. package/src/getThreadInfoDeprecated.js +0 -56
  70. package/src/getThreadListDeprecated.js +0 -46
  71. package/src/getUID.js +0 -119
  72. package/src/searchStickers.js +0 -53
  73. package/src/sendMessageMqtt.js +0 -322
  74. package/src/sendTypingIndicatorV2.js +0 -28
  75. package/src/setMessageReactionMqtt.js +0 -62
  76. package/src/setStoryReaction.js +0 -64
  77. package/src/shareContact.js +0 -110
  78. package/src/shareLink.js +0 -59
  79. package/src/stopListenMqtt.js +0 -23
@@ -1,322 +0,0 @@
1
- var utils = require("../utils");
2
- // @NethWs3Dev
3
- var bluebird = require("bluebird");
4
-
5
- module.exports = function (defaultFuncs, api, ctx) {
6
- function uploadAttachment(attachments, callback) {
7
- callback = callback || function () {};
8
- var uploads = [];
9
-
10
- // create an array of promises
11
- for (var i = 0; i < attachments.length; i++) {
12
- if (!utils.isReadableStream(attachments[i])) {
13
- throw {
14
- error:
15
- "Attachment should be a readable stream and not " +
16
- utils.getType(attachments[i]) +
17
- ".",
18
- };
19
- }
20
-
21
- var form = {
22
- upload_1024: attachments[i],
23
- voice_clip: "true",
24
- };
25
-
26
- uploads.push(
27
- defaultFuncs
28
- .postFormData(
29
- "https://upload.facebook.com/ajax/mercury/upload.php",
30
- ctx.jar,
31
- form,
32
- {},
33
- )
34
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
35
- .then(function (resData) {
36
- if (resData.error) {
37
- throw resData;
38
- }
39
-
40
- // We have to return the data unformatted unless we want to change it
41
- // back in sendMessage.
42
- return resData.payload.metadata[0];
43
- }),
44
- );
45
- }
46
-
47
- // resolve all promises
48
- bluebird
49
- .all(uploads)
50
- .then(function (resData) {
51
- callback(null, resData);
52
- })
53
- .catch(function (err) {
54
- console.error("uploadAttachment", err);
55
- return callback(err);
56
- });
57
- }
58
-
59
- let variance = 0;
60
- const epoch_id = () =>
61
- Math.floor(Date.now() * (4194304 + (variance = (variance + 0.1) % 5)));
62
- const emojiSizes = {
63
- small: 1,
64
- medium: 2,
65
- large: 3,
66
- };
67
-
68
- function handleEmoji(msg, form, callback, cb) {
69
- if (msg.emojiSize != null && msg.emoji == null) {
70
- return callback({ error: "emoji property is empty" });
71
- }
72
- if (msg.emoji) {
73
- if (!msg.emojiSize) {
74
- msg.emojiSize = "small";
75
- }
76
- if (
77
- msg.emojiSize !== "small" &&
78
- msg.emojiSize !== "medium" &&
79
- msg.emojiSize !== "large" &&
80
- (isNaN(msg.emojiSize) || msg.emojiSize < 1 || msg.emojiSize > 3)
81
- ) {
82
- return callback({ error: "emojiSize property is invalid" });
83
- }
84
-
85
- form.payload.tasks[0].payload.send_type = 1;
86
- form.payload.tasks[0].payload.text = msg.emoji;
87
- form.payload.tasks[0].payload.hot_emoji_size = !isNaN(msg.emojiSize)
88
- ? msg.emojiSize
89
- : emojiSizes[msg.emojiSize];
90
- }
91
- cb();
92
- }
93
-
94
- function handleSticker(msg, form, callback, cb) {
95
- if (msg.sticker) {
96
- form.payload.tasks[0].payload.send_type = 2;
97
- form.payload.tasks[0].payload.sticker_id = msg.sticker;
98
- }
99
- cb();
100
- }
101
-
102
- function handleAttachment(msg, form, callback, cb) {
103
- if (msg.attachment) {
104
- form.payload.tasks[0].payload.send_type = 3;
105
- form.payload.tasks[0].payload.attachment_fbids = [];
106
- if (form.payload.tasks[0].payload.text == "")
107
- form.payload.tasks[0].payload.text = null;
108
- if (utils.getType(msg.attachment) !== "Array") {
109
- msg.attachment = [msg.attachment];
110
- }
111
-
112
- uploadAttachment(msg.attachment, function (err, files) {
113
- if (err) {
114
- return callback(err);
115
- }
116
-
117
- files.forEach(function (file) {
118
- var key = Object.keys(file);
119
- var type = key[0]; // image_id, file_id, etc
120
- form.payload.tasks[0].payload.attachment_fbids.push(file[type]); // push the id
121
- });
122
- cb();
123
- });
124
- } else {
125
- cb();
126
- }
127
- }
128
-
129
- function handleMention(msg, form, callback, cb) {
130
- if (msg.mentions) {
131
- form.payload.tasks[0].payload.send_type = 1;
132
-
133
- const arrayIds = [];
134
- const arrayOffsets = [];
135
- const arrayLengths = [];
136
- const mention_types = [];
137
-
138
- for (let i = 0; i < msg.mentions.length; i++) {
139
- const mention = msg.mentions[i];
140
-
141
- const tag = mention.tag;
142
- if (typeof tag !== "string") {
143
- return callback({ error: "Mention tags must be strings." });
144
- }
145
-
146
- const offset = msg.body.indexOf(tag, mention.fromIndex || 0);
147
-
148
- if (offset < 0) {
149
- console.warn(
150
- "handleMention",
151
- 'Mention for "' + tag + '" not found in message string.',
152
- );
153
- }
154
-
155
- if (mention.id == null) {
156
- console.warn("handleMention", "Mention id should be non-null.");
157
- }
158
-
159
- const id = mention.id || 0;
160
- arrayIds.push(id);
161
- arrayOffsets.push(offset);
162
- arrayLengths.push(tag.length);
163
- mention_types.push("p");
164
- }
165
-
166
- form.payload.tasks[0].payload.mention_data = {
167
- mention_ids: arrayIds.join(","),
168
- mention_offsets: arrayOffsets.join(","),
169
- mention_lengths: arrayLengths.join(","),
170
- mention_types: mention_types.join(","),
171
- };
172
- }
173
- cb();
174
- }
175
-
176
- function handleLocation(msg, form, callback, cb) {
177
- // this is not working yet
178
- if (msg.location) {
179
- if (msg.location.latitude == null || msg.location.longitude == null) {
180
- return callback({
181
- error: "location property needs both latitude and longitude",
182
- });
183
- }
184
-
185
- form.payload.tasks[0].payload.send_type = 1;
186
- form.payload.tasks[0].payload.location_data = {
187
- coordinates: {
188
- latitude: msg.location.latitude,
189
- longitude: msg.location.longitude,
190
- },
191
- is_current_location: !!msg.location.current,
192
- is_live_location: !!msg.location.live,
193
- };
194
- }
195
-
196
- cb();
197
- }
198
-
199
- function send(form, threadID, callback, replyToMessage) {
200
- if (replyToMessage) {
201
- form.payload.tasks[0].payload.reply_metadata = {
202
- reply_source_id: replyToMessage,
203
- reply_source_type: 1,
204
- reply_type: 0,
205
- };
206
- }
207
- const mqttClient = ctx.mqttClient;
208
- form.payload.tasks.forEach((task) => {
209
- task.payload = JSON.stringify(task.payload);
210
- });
211
- form.payload = JSON.stringify(form.payload);
212
- console.log(global.jsonStringifyColor(form, null, 2));
213
-
214
- return mqttClient.publish(
215
- "/ls_req",
216
- JSON.stringify(form),
217
- function (err, data) {
218
- if (err) {
219
- console.error("Error publishing message: ", err);
220
- callback(err);
221
- } else {
222
- console.log("Message published successfully with data: ", data);
223
- callback(null, data);
224
- }
225
- },
226
- );
227
- }
228
-
229
- return function sendMessageMqtt(msg, threadID, callback, replyToMessage) {
230
- if (
231
- !callback &&
232
- (utils.getType(threadID) === "Function" ||
233
- utils.getType(threadID) === "AsyncFunction")
234
- ) {
235
- return threadID({ error: "Pass a threadID as a second argument." });
236
- }
237
- if (!replyToMessage && utils.getType(callback) === "String") {
238
- replyToMessage = callback;
239
- callback = function () {};
240
- }
241
-
242
- if (!callback) {
243
- callback = function (err, friendList) {};
244
- }
245
-
246
- var msgType = utils.getType(msg);
247
- var threadIDType = utils.getType(threadID);
248
- var messageIDType = utils.getType(replyToMessage);
249
-
250
- if (msgType !== "String" && msgType !== "Object") {
251
- return callback({
252
- error:
253
- "Message should be of type string or object and not " + msgType + ".",
254
- });
255
- }
256
-
257
- if (msgType === "String") {
258
- msg = { body: msg };
259
- }
260
-
261
- const timestamp = Date.now();
262
- // get full date time
263
- const epoch = timestamp << 22;
264
- //const otid = epoch + 0; // TODO replace with randomInt(0, 2**22)
265
- const otid = epoch + Math.floor(Math.random() * 4194304);
266
-
267
- const form = {
268
- app_id: "2220391788200892",
269
- payload: {
270
- tasks: [
271
- {
272
- label: "46",
273
- payload: {
274
- thread_id: threadID.toString(),
275
- otid: otid.toString(),
276
- source: 0,
277
- send_type: 1,
278
- sync_group: 1,
279
- text:
280
- msg.body != null && msg.body != undefined
281
- ? msg.body.toString()
282
- : "",
283
- initiating_source: 1,
284
- skip_url_preview_gen: 0,
285
- },
286
- queue_name: threadID.toString(),
287
- task_id: 0,
288
- failure_count: null,
289
- },
290
- {
291
- label: "21",
292
- payload: {
293
- thread_id: threadID.toString(),
294
- last_read_watermark_ts: Date.now(),
295
- sync_group: 1,
296
- },
297
- queue_name: threadID.toString(),
298
- task_id: 1,
299
- failure_count: null,
300
- },
301
- ],
302
- epoch_id: epoch_id(),
303
- version_id: "6120284488008082",
304
- data_trace_id: null,
305
- },
306
- request_id: 1,
307
- type: 3,
308
- };
309
-
310
- handleEmoji(msg, form, callback, function () {
311
- handleLocation(msg, form, callback, function () {
312
- handleMention(msg, form, callback, function () {
313
- handleSticker(msg, form, callback, function () {
314
- handleAttachment(msg, form, callback, function () {
315
- send(form, threadID, callback, replyToMessage);
316
- });
317
- });
318
- });
319
- });
320
- });
321
- };
322
- };
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
-
4
-
5
- var utils = require("../utils");
6
- // @NethWs3Dev
7
-
8
- module.exports = function (defaultFuncs, api, ctx) {
9
- return async function sendTypingIndicatorV2(sendTyping,threadID, callback) {
10
- let count_req = 0
11
- var wsContent = {
12
- app_id: 2220391788200892,
13
- payload: JSON.stringify({
14
- label: 3,
15
- payload: JSON.stringify({
16
- thread_key: threadID.toString(),
17
- is_group_thread: +(threadID.toString().length >= 16),
18
- is_typing: +sendTyping,
19
- attribution: 0
20
- }),
21
- version: 5849951561777440
22
- }),
23
- request_id: ++count_req,
24
- type: 4
25
- };
26
- await new Promise((resolve, reject) => mqttClient.publish('/ls_req', JSON.stringify(wsContent), {}, (err, _packet) => err ? reject(err) : resolve()));
27
- };
28
- };
@@ -1,62 +0,0 @@
1
-
2
- 'use strict';
3
-
4
- const { generateOfflineThreadingID } = require('../utils');
5
-
6
- function isCallable(func) {
7
- try {
8
- Reflect.apply(func, null, []);
9
- return true;
10
- } catch (error) {
11
- return false;
12
- }
13
- }
14
-
15
- module.exports = function (defaultFuncs, api, ctx) {
16
- return function setMessageReactionMqtt(reaction, messageID, threadID, callback) {
17
- if (!ctx.mqttClient) {
18
- throw new Error('Not connected to MQTT');
19
- }
20
-
21
-
22
- ctx.wsReqNumber += 1;
23
- ctx.wsTaskNumber += 1;
24
-
25
- const taskPayload = {
26
- thread_key: threadID,
27
- timestamp_ms: Date.now(),
28
- message_id: messageID,
29
- reaction: reaction,
30
- actor_id: ctx.userID,
31
- reaction_style: null,
32
- sync_group: 1,
33
- send_attribution: Math.random() < 0.5 ? 65537 : 524289
34
- };
35
-
36
- const task = {
37
- failure_count: null,
38
- label: '29',
39
- payload: JSON.stringify(taskPayload),
40
- queue_name: JSON.stringify(['reaction', messageID]),
41
- task_id: ctx.wsTaskNumber,
42
- };
43
-
44
- const content = {
45
- app_id: '2220391788200892',
46
- payload: JSON.stringify({
47
- data_trace_id: null,
48
- epoch_id: parseInt(generateOfflineThreadingID()),
49
- tasks: [task],
50
- version_id: '7158486590867448',
51
- }),
52
- request_id: ctx.wsReqNumber,
53
- type: 3,
54
- };
55
-
56
- if (isCallable(callback)) {
57
- ctx.reqCallbacks[ctx.wsReqNumber] = callback;
58
- }
59
-
60
- ctx.mqttClient.publish('/ls_req', JSON.stringify(content), { qos: 1, retain: false });
61
- };
62
- };
@@ -1,64 +0,0 @@
1
- 'use strict';
2
-
3
- var utils = require('../utils.js');
4
- var log = require('npmlog');
5
-
6
- module.exports = function(defaultFuncs, api, ctx) {
7
- return function setStoryReaction(storyID, react, callback) {
8
- var cb;
9
- var returnPromise = new Promise(function(resolve, reject) {
10
- cb = error => error ? reject(error) : resolve();
11
- });
12
-
13
- if (typeof react == 'function') {
14
- callback = react;
15
- react = 1;
16
- }
17
- if (typeof callback == 'function') cb = callback;
18
- if (typeof Number(react) != 'number') react = 1;
19
-
20
- var map = {
21
- 1: '👍',
22
- 2: '❤️',
23
- 3: '🤗',
24
- 4: '😆',
25
- 5: '😮',
26
- 6: '😢',
27
- 7: '😡'
28
- }
29
- var form = {
30
- fb_api_req_friendly_name: 'useStoriesSendReplyMutation',
31
- variables: JSON.stringify({
32
- input: {
33
- attribution_id_v2: `StoriesCometSuspenseRoot.react,comet.stories.viewer,unexpected,${Date.now()},538296,,;CometHomeRoot.react,comet.home,via_cold_start,${Date.now()},850302,4748854339,`,
34
- lightweight_reaction_actions: {
35
- offsets: [0],
36
- reaction: map[react] || map[1]
37
- },
38
- message: map[react] || map[1],
39
- story_id: storyID,
40
- story_reply_type: "LIGHT_WEIGHT",
41
- actor_id: ctx.userID,
42
- client_mutation_id: String(parseInt(Math.random() * 16))
43
- }
44
- }),
45
- doc_id: '4826141330837571'
46
- }
47
-
48
- defaultFuncs
49
- .post('https://www.facebook.com/api/graphql/', ctx.jar, form)
50
- .then(utils.parseAndCheckLogin(ctx, defaultFuncs))
51
- .then(function(res) {
52
- if (res.errors) throw res;
53
- return cb();
54
- })
55
- .catch(function(err) {
56
- console.error('setPostReaction', err);
57
- return cb(err);
58
- });
59
-
60
- return returnPromise;
61
- }
62
- }
63
-
64
- //new update version 1.0.9
@@ -1,110 +0,0 @@
1
- /* eslint-disable linebreak-style */
2
- "use strict";
3
-
4
- // fixed by kenneth panio
5
-
6
- var utils = require("../utils");
7
-
8
- module.exports = function(defaultFuncs, api, ctx) {
9
- return function shareContact(text, senderID, threadID, callback) {
10
- if (!ctx.mqttClient) {
11
- throw new Error('Not connected to MQTT');
12
- }
13
-
14
- ctx.wsReqNumber ??= 0;
15
- ctx.wsTaskNumber ??= 0;
16
-
17
- ctx.wsReqNumber += 1;
18
- ctx.wsTaskNumber += 1;
19
-
20
- const queryPayload = {
21
- contact_id: senderID,
22
- sync_group: 1,
23
- text: text || "",
24
- thread_id: threadID
25
- };
26
-
27
- const query = {
28
- failure_count: null,
29
- label: '359',
30
- payload: JSON.stringify(queryPayload),
31
- queue_name: 'messenger_contact_sharing',//xma_open_contact_share
32
- task_id: Math.random() * 1001 << 0,
33
- };
34
-
35
- const context = {
36
- app_id: '2220391788200892',
37
- payload: {
38
- tasks: [query],
39
- epoch_id: utils.generateOfflineThreadingID(),
40
- version_id: '7214102258676893',
41
- },
42
- request_id: ctx.wsReqNumber,
43
- type: 3,
44
- };
45
-
46
- context.payload = JSON.stringify(context.payload);
47
-
48
- if (typeof callback === 'function') {
49
- ctx.callback_Task[ctx.wsReqNumber] = { callback, type: "shareContact" };
50
- }
51
-
52
- ctx.mqttClient.publish('/ls_req', JSON.stringify(context), { qos: 1, retain: false });
53
- };
54
- };
55
-
56
- /*"use strict";
57
-
58
-
59
- var utils = require("../utils");
60
-
61
- // @NethWs3Dev
62
-
63
-
64
- module.exports = function (defaultFuncs, api, ctx) {
65
- return async function shareContact(text, senderID, threadID, callback) {
66
- await utils.parseAndCheckLogin(ctx, defaultFuncs);
67
- const mqttClient = ctx.mqttClient;
68
-
69
- if (!mqttClient) {
70
- throw new Error("Not connected to MQTT");
71
- }
72
- var resolveFunc = function () { };
73
- var rejectFunc = function () { };
74
- var returnPromise = new Promise(function (resolve, reject) {
75
- resolveFunc = resolve;
76
- rejectFunc = reject;
77
- });
78
- if (!callback) {
79
- callback = function (err, data) {
80
- if (err) return rejectFunc(err);
81
- resolveFunc(data);
82
- data };
83
- }
84
- let count_req = 0
85
- var form = JSON.stringify({
86
- "app_id": "2220391788200892",
87
- "payload": JSON.stringify({
88
- tasks: [{
89
- label: '359',
90
- payload: JSON.stringify({
91
- "contact_id": senderID,
92
- "sync_group": 1,
93
- "text": text || "",
94
- "thread_id": threadID
95
- }),
96
- queue_name: 'messenger_contact_sharing',
97
- task_id: Math.random() * 1001 << 0,
98
- failure_count: null,
99
- }],
100
- epoch_id: utils.generateOfflineThreadingID(),
101
- version_id: '7214102258676893',
102
- }),
103
- "request_id": ++count_req,
104
- "type": 3
105
- });
106
- mqttClient.publish('/ls_req',form)
107
-
108
- return returnPromise;
109
- };
110
- };*/
package/src/shareLink.js DELETED
@@ -1,59 +0,0 @@
1
-
2
- "use strict";
3
-
4
- var utils = require("../utils");
5
- // @NethWs3Dev
6
-
7
- module.exports = function (defaultFuncs, api, ctx) {
8
- return async function shareLink(text, url, threadID, callback) {
9
- var resolveFunc = function () {};
10
- var rejectFunc = function () {};
11
- var returnPromise = new Promise(function (resolve, reject) {
12
- resolveFunc = resolve;
13
- rejectFunc = reject;
14
- });
15
- if (!callback) {
16
- callback = function (err, data) {
17
- if (err) return rejectFunc(err);
18
- resolveFunc(data);
19
- };
20
- }
21
- ctx.mqttClient.publish('/ls_req',
22
- JSON.stringify({
23
- "app_id": "2220391788200892",
24
- "payload": JSON.stringify({
25
- tasks: [{
26
- label: 46,
27
- payload: JSON.stringify({
28
- "otid": utils.generateOfflineThreadingID(),
29
- "source": 524289,
30
- "sync_group": 1,
31
- "send_type": 6,
32
- "mark_thread_read": 0,
33
- "url": url || "https://www.facebook.com/haji.atomyc2727",
34
- "text": text || "",
35
- "thread_id": threadID,
36
- "initiating_source": 0
37
- }),
38
- queue_name: threadID,
39
- task_id: Math.random() * 1001 << 0,
40
- failure_count: null,
41
- }],
42
- epoch_id: utils.generateOfflineThreadingID(),
43
- version_id: '7191105584331330',
44
- }),
45
- "request_id": ++ctx.req_ID,
46
- "type": 3
47
- }),
48
- {
49
- qos: 1,
50
- retain: false,
51
- }
52
- )
53
- ctx.callback_Task[ctx.req_ID] = new Object({
54
- callback,
55
- type: "shareLink"
56
- });
57
- return returnPromise;
58
- };
59
- };
@@ -1,23 +0,0 @@
1
- "use strict";
2
-
3
- /*
4
- @NethWs3Dev
5
- */
6
-
7
- // @NethWs3Dev
8
- module.exports = function (defaultFuncs, api, ctx){
9
- return function stopListenMqtt() {
10
- if (!ctx.mqttClient) {
11
- throw new Error("Not connected to MQTT");
12
- }
13
- console.log("stopListenMqtt", "Stopping...");
14
- ctx.mqttClient.unsubscribe("/webrtc");
15
- ctx.mqttClient.unsubscribe("/rtc_multi");
16
- ctx.mqttClient.unsubscribe("/onevc");
17
- ctx.mqttClient.publish("/browser_close", "{}");
18
- ctx.mqttClient.end(false, (...data) => {
19
- console.log("stopListenMqtt", "Stopped");
20
- ctx.mqttClient = null;
21
- });
22
- }
23
- };