buttplug 3.2.1 → 3.2.2
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/.yarnrc.yml +4 -0
- package/CHANGELOG.md +6 -0
- package/package.json +21 -21
- package/src/utils/ButtplugBrowserWebsocketConnector.ts +25 -28
package/.yarnrc.yml
CHANGED
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "buttplug",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Buttplug Client Implementation for Typescript/Javascript",
|
|
5
5
|
"homepage": "https://github.com/buttplugio/buttplug-js/",
|
|
6
6
|
"repository": {
|
|
@@ -32,38 +32,38 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"class-transformer": "^0.5.1",
|
|
34
34
|
"eventemitter3": "^5.0.1",
|
|
35
|
-
"reflect-metadata": "^0.1
|
|
36
|
-
"ws": "^8.
|
|
35
|
+
"reflect-metadata": "^0.2.1",
|
|
36
|
+
"ws": "^8.16.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/commander": "^2.12.2",
|
|
40
|
-
"@types/expect-puppeteer": "^5.0.
|
|
41
|
-
"@types/jest": "^29.5.
|
|
42
|
-
"@types/jest-environment-puppeteer": "^5.0.
|
|
43
|
-
"@types/node": "^20.
|
|
44
|
-
"@types/uuid-parse": "^1.0.
|
|
45
|
-
"@types/ws": "^8.5.
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
47
|
-
"@typescript-eslint/parser": "^
|
|
40
|
+
"@types/expect-puppeteer": "^5.0.6",
|
|
41
|
+
"@types/jest": "^29.5.12",
|
|
42
|
+
"@types/jest-environment-puppeteer": "^5.0.6",
|
|
43
|
+
"@types/node": "^20.11.24",
|
|
44
|
+
"@types/uuid-parse": "^1.0.2",
|
|
45
|
+
"@types/ws": "^8.5.10",
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^7.1.0",
|
|
47
|
+
"@typescript-eslint/parser": "^7.1.0",
|
|
48
48
|
"copyfiles": "^2.4.1",
|
|
49
49
|
"cross-env": "^7.0.3",
|
|
50
|
-
"eslint": "^8.
|
|
50
|
+
"eslint": "^8.57.0",
|
|
51
51
|
"eslint-plugin-node": "^11.1.0",
|
|
52
|
-
"gts": "^5.0
|
|
52
|
+
"gts": "^5.2.0",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
54
|
"mock-socket": "^9.3.1",
|
|
55
55
|
"pkg": "^5.8.1",
|
|
56
|
-
"tmp": "^0.2.
|
|
56
|
+
"tmp": "^0.2.3",
|
|
57
57
|
"trash": "^8.1.1",
|
|
58
58
|
"trash-cli": "^5.0.0",
|
|
59
|
-
"ts-jest": "^29.1.
|
|
60
|
-
"ts-node": "^10.9.
|
|
59
|
+
"ts-jest": "^29.1.2",
|
|
60
|
+
"ts-node": "^10.9.2",
|
|
61
61
|
"tslib": "^2.6.2",
|
|
62
|
-
"typedoc": "^0.25.
|
|
63
|
-
"typescript": "^5.
|
|
64
|
-
"vite": "^
|
|
65
|
-
"vite-plugin-dts": "^3.
|
|
66
|
-
"yarn": "^1.22.
|
|
62
|
+
"typedoc": "^0.25.9",
|
|
63
|
+
"typescript": "^5.3.3",
|
|
64
|
+
"vite": "^5.1.4",
|
|
65
|
+
"vite-plugin-dts": "^3.7.3",
|
|
66
|
+
"yarn": "^1.22.21"
|
|
67
67
|
},
|
|
68
68
|
"jest": {
|
|
69
69
|
"moduleFileExtensions": [
|
|
@@ -25,35 +25,32 @@ export class ButtplugBrowserWebsocketConnector extends EventEmitter {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
public connect = async (): Promise<void> => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
28
|
+
return new Promise<void>((resolve, reject) => {
|
|
29
|
+
const ws = new (this._websocketConstructor ?? WebSocket)(this._url);
|
|
30
|
+
const onErrorCallback = (event: Event) => {reject(event)}
|
|
31
|
+
const onCloseCallback = (event: CloseEvent) => reject(event.reason)
|
|
32
|
+
ws.addEventListener('open', async () => {
|
|
33
|
+
this._ws = ws;
|
|
34
|
+
try {
|
|
35
|
+
await this.initialize();
|
|
36
|
+
this._ws.addEventListener('message', (msg) => {
|
|
37
|
+
this.parseIncomingMessage(msg);
|
|
38
|
+
});
|
|
39
|
+
this._ws.removeEventListener('close', onCloseCallback);
|
|
40
|
+
this._ws.removeEventListener('error', onErrorCallback);
|
|
41
|
+
this._ws.addEventListener('close', this.disconnect);
|
|
42
|
+
resolve();
|
|
43
|
+
} catch (e) {
|
|
44
|
+
reject(e);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
// In websockets, our error rarely tells us much, as for security reasons
|
|
48
|
+
// browsers usually only throw Error Code 1006. It's up to those using this
|
|
49
|
+
// library to state what the problem might be.
|
|
50
|
+
|
|
51
|
+
ws.addEventListener('error', onErrorCallback)
|
|
52
|
+
ws.addEventListener('close', onCloseCallback);
|
|
54
53
|
});
|
|
55
|
-
ws.addEventListener('close', conErrorCallback);
|
|
56
|
-
return p;
|
|
57
54
|
};
|
|
58
55
|
|
|
59
56
|
public disconnect = async (): Promise<void> => {
|