@wxn0brp/gloves-link-client 0.0.3 → 0.0.4
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/README.md +61 -0
- package/package.json +35 -38
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# GlovesLink
|
|
2
|
+
|
|
3
|
+
GlovesLink is a WebSocket communication library designed for seamless interaction between clients and servers.
|
|
4
|
+
|
|
5
|
+
[Main repo](https://github.com/wxn0brP/GlovesLink) |
|
|
6
|
+
[Client repo](https://github.com/wxn0brP/GlovesLink-client) |
|
|
7
|
+
[Server repo](https://github.com/wxn0brP/GlovesLink-server)
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
### General
|
|
12
|
+
- **WebSocket Communication**: Establish real-time communication between clients and servers.
|
|
13
|
+
- **Automatic Reconnection**: Automatically reconnects after disconnection.
|
|
14
|
+
- **Authentication Support**: Token-based authentication for secure connections.
|
|
15
|
+
- **Logging**: Optional logging for debugging and monitoring.
|
|
16
|
+
- **Rooms**: Organize communication within specific rooms for better organization and control.
|
|
17
|
+
|
|
18
|
+
### Communication
|
|
19
|
+
- **Event Emission**: Send events with arbitrary data.
|
|
20
|
+
- **Callbacks**: Handle server/client responses with callback functions.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm i @wxn0brp/gloves-link-client
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import GlovesLinkClient from '@wxn0brp/gloves-link/client';
|
|
32
|
+
//or browser
|
|
33
|
+
import GlovesLinkClient from 'path/to/your/GlovesLinkClient.js';
|
|
34
|
+
// if you use falcon-frame
|
|
35
|
+
import GlovesLinkClient from '/gloves-link/client';
|
|
36
|
+
|
|
37
|
+
const client = new GlovesLinkClient('ws://example.com', {
|
|
38
|
+
reConnect: true,
|
|
39
|
+
reConnectInterval: 5000,
|
|
40
|
+
logs: true,
|
|
41
|
+
token: 'your-auth-token'
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
client.on('connect', () => {
|
|
45
|
+
console.log('Connected to server');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
client.on('response', (message) => {
|
|
49
|
+
console.log('Response from server:', message);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
client.emit('exampleEvent', { hello: 'world' });
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
MIT License
|
|
58
|
+
|
|
59
|
+
## Contributing
|
|
60
|
+
|
|
61
|
+
Contributions are welcome!
|
package/package.json
CHANGED
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
"name": "@wxn0brp/gloves-link-client",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"author": "wxn0brP",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/wxn0brP/GlovesLink-client.git"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/wxn0brP/GlovesLink",
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/bun": "*",
|
|
16
|
+
"@types/ws": "^8.18.1",
|
|
17
|
+
"esbuild": "^*",
|
|
18
|
+
"tsc-alias": "*",
|
|
19
|
+
"typescript": "*"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"ws": "^8.18.3"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"default": "./dist/index.js"
|
|
12
32
|
},
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@types/bun": "*",
|
|
19
|
-
"@types/ws": "^8.18.1",
|
|
20
|
-
"esbuild": "^*",
|
|
21
|
-
"tsc-alias": "*",
|
|
22
|
-
"typescript": "*"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"ws": "^8.18.3"
|
|
26
|
-
},
|
|
27
|
-
"files": [
|
|
28
|
-
"dist"
|
|
29
|
-
],
|
|
30
|
-
"exports": {
|
|
31
|
-
".": {
|
|
32
|
-
"types": "./dist/index.d.ts",
|
|
33
|
-
"import": "./dist/index.js",
|
|
34
|
-
"default": "./dist/index.js"
|
|
35
|
-
},
|
|
36
|
-
"./*": {
|
|
37
|
-
"types": "./dist/*.d.ts",
|
|
38
|
-
"import": "./dist/*.js",
|
|
39
|
-
"default": "./dist/*.js"
|
|
40
|
-
}
|
|
33
|
+
"./*": {
|
|
34
|
+
"types": "./dist/*.d.ts",
|
|
35
|
+
"import": "./dist/*.js",
|
|
36
|
+
"default": "./dist/*.js"
|
|
41
37
|
}
|
|
38
|
+
}
|
|
42
39
|
}
|