miakapi 3.0.2-DEV → 3.0.31

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/main.js CHANGED
@@ -47,8 +47,7 @@ const connect = async (credentials, {
47
47
  let socket = null;
48
48
 
49
49
  function sendPacket(type, data) {
50
- socket.sendBytes(Buffer.from(`${type}${data}`));
51
- console.log('sendPacket =>', type, data.length);
50
+ if (socket) socket.sendBytes(Buffer.from(`${type}${data}`));
52
51
  }
53
52
 
54
53
  client.on('connect', (s) => {
@@ -118,8 +117,8 @@ const connect = async (credentials, {
118
117
 
119
118
  s.on('close', (code, desc) => {
120
119
  console.log('CLOSE', code, desc);
121
- if (code === 4005) return;
122
- setTimeout(newSocket, 200);
120
+ if ([4001, 4005].includes(code)) return;
121
+ setTimeout(newSocket, 1000);
123
122
  });
124
123
  });
125
124
 
@@ -205,9 +204,9 @@ const connect = async (credentials, {
205
204
  * @property {(callback: (users: User[]) => void) => void
206
205
  * } onUpdate Event that handles when an update of home settings happens
207
206
  * @property {(callback: (event: UserLoginEvent) => void) => void
208
- * } onUserLogin Event that handles when an user connects or disconnects
207
+ * } onUserLogin Event that handles when a user connects or disconnects
209
208
  * @property {(callback: (action: UserActionEvent) => void) => void
210
- * } onUserAction Event that handles when an user interact with a page
209
+ * } onUserAction Event that handles when a user interact with a page
211
210
  * @property {() => void} reconnect Restart connection to the server
212
211
  */
213
212
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miakapi",
3
- "version": "3.0.2-DEV",
3
+ "version": "3.0.31",
4
4
  "description": "Miakapi for Miakapp V3",
5
5
  "main": "main.js",
6
6
  "scripts": {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/Miakapp/MiakAPI"
11
+ "url": "git+https://github.com/Miakapp/MiakAPI.git"
12
12
  },
13
13
  "keywords": [
14
14
  "Miakapp",
Binary file
Binary file
Binary file