rdh-socket-client 1.1.3 → 1.1.5

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": "rdh-socket-client",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Client Socket for rdh-socket",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -10,7 +10,6 @@
10
10
  "author": "RAKOTONDRAMANANA David Henintsoa",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "axios": "^1.6.2",
14
13
  "socket.io-client": "^4.7.2"
15
14
  }
16
15
  }
package/src/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- import axios from "axios";
2
1
  import Channel from "./Channel";
3
2
  import { Options } from "./types";
4
3
  import io, { Socket } from 'socket.io-client';
@@ -7,10 +6,8 @@ export default class RdhClientSocket {
7
6
  private options: Options;
8
7
  private ws_host: string;
9
8
  private socket: Socket;
10
- private api_url: string;
11
-
9
+ $
12
10
  constructor(options: Options) {
13
- this.api_url = "https://rdh-socket.wuaze.com/api/subscribe"
14
11
 
15
12
  if (!options.app_ws) {
16
13
  this.ws_host = "https://rdh-websocket.onrender.com"
@@ -20,30 +17,14 @@ export default class RdhClientSocket {
20
17
 
21
18
  this.options = options;
22
19
  this.init();
23
-
24
- this.socket.on('warning_from_server', (message) => {
25
- throw new Error(message);
26
- })
27
20
  }
28
21
 
29
22
  async init() {
30
- const status = await this.verifyToken()
31
- this.options.status = status;
32
23
  this.socket = io(this.ws_host, {
33
24
  query: this.options
34
25
  });
35
26
  }
36
27
 
37
- async verifyToken() {
38
- const fullURL = this.api_url+`?app_id=${this.options.app_id}&app_key=${this.options.app_key}`
39
-
40
- return await axios.get(fullURL).then(response => {
41
- return response.data.status;
42
- }).catch(() => {
43
- return false;
44
- })
45
- }
46
-
47
28
  channel(channel_name: string): Channel {
48
29
  let finalChannelName = this.options.app_id+'_'+channel_name;
49
30
  return new Channel(finalChannelName, this.socket);
@@ -4,5 +4,4 @@ export type Options = {
4
4
  app_id: string;
5
5
  app_ws: string | null | undefined;
6
6
  app_key: string;
7
- status: boolean | false;
8
7
  };