@dnotifier-realtime/dnotifier 1.0.8 → 1.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnotifier-realtime/dnotifier",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "Real-time notification & messaging SDK",
5
5
  "main": "src/dnotifier.js",
6
6
  "type": "module",
package/src/dnotifier.js CHANGED
@@ -196,7 +196,8 @@ export class DNotifier {
196
196
  this.appId = appId;
197
197
  this.secret = secret;
198
198
  this.userId = userId;
199
- this.url = "ws://34.208.142.201:7072";
199
+ //this.url = "ws://127.0.0.1:7072";
200
+ this.url = "wss://link.dchatter.com/ws";
200
201
 
201
202
  this.onConnectedCallback = onConnected || (() => {});
202
203
  this.onMessageCallback = onMessage || (() => {});
@@ -238,11 +239,13 @@ export class DNotifier {
238
239
  appId: this.appId,
239
240
  sender: prefixId(this.appId, this.userId),
240
241
  timestamp: Date.now(),
242
+ token : this.authToken
241
243
  };
242
244
 
243
245
  const payloadBuffer = toUint8(
244
246
  JSON.stringify({ token: this.authToken })
245
247
  );
248
+ // console.log(this.authToken)
246
249
 
247
250
  const frame = framePacket(metadata, payloadBuffer);
248
251
  this.transport.sendBinary(frame);
@@ -315,6 +318,7 @@ export class DNotifier {
315
318
  prefixId(this.appId, id)
316
319
  ),
317
320
  timestamp: Date.now(),
321
+ token : this.authToken
318
322
  };
319
323
 
320
324
  const payloadBuffer = toUint8(JSON.stringify(data));
@@ -336,6 +340,7 @@ export class DNotifier {
336
340
  prefixId(this.appId, id)
337
341
  ),
338
342
  timestamp: Date.now(),
343
+ token : this.authToken
339
344
  };
340
345
 
341
346
  const frame = framePacket(metadata, buffer);
@@ -100,7 +100,7 @@ export class WebsocketTransport extends EventEmitter {
100
100
 
101
101
  // 📩 MESSAGE
102
102
  this._on("message", async (event, isBinary) => {
103
- console.log('event', event)
103
+ // console.log('event', event)
104
104
  var data = event?.data ?? event;
105
105
 
106
106
  // Convert Blob -> ArrayBuffer in browser
@@ -18,7 +18,6 @@ export class Payload {
18
18
  try {
19
19
  return JSON.parse(this.buffer.toString(encoding));
20
20
  } catch (err) {
21
- console.log(err)
22
21
  return null;
23
22
  }
24
23
  }