@wxn0brp/gloves-link-server 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.
Files changed (2) hide show
  1. package/README.md +63 -0
  2. package/package.json +43 -46
package/README.md ADDED
@@ -0,0 +1,63 @@
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-server @wxn0brp/falcon-frame
26
+ ```
27
+
28
+ ## Usage
29
+
30
+ ```typescript
31
+ import { GlovesLinkServer } from '@wxn0brp/gloves-link/server';
32
+ import { FalconFrame } from '@wxn0brp/falcon-frame';
33
+
34
+ const app = new FalconFrame();
35
+ const httpServer = app.listen(3000);
36
+
37
+ const glovesLink = new GlovesLinkServer({
38
+ server: httpServer,
39
+ logs: true,
40
+ authFn: async ({ headers, url, token }) => {
41
+ // Implement your authentication logic here
42
+ return true;
43
+ }
44
+ });
45
+ glovesLink.falconFrame(app);
46
+
47
+ glovesLink.onConnect((socket) => {
48
+ console.log('New connection:', socket.id);
49
+
50
+ socket.on('exampleEvent', (data) => {
51
+ console.log('Received data:', data);
52
+ socket.emit('response', 'Hello from server');
53
+ });
54
+ });
55
+ ```
56
+
57
+ ## License
58
+
59
+ MIT License
60
+
61
+ ## Contributing
62
+
63
+ Contributions are welcome!
package/package.json CHANGED
@@ -1,50 +1,47 @@
1
1
  {
2
- "name": "@wxn0brp/gloves-link-server",
3
- "version": "0.0.3",
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-server.git"
12
- },
13
- "homepage": "https://github.com/wxn0brP/GlovesLink",
14
- "scripts": {
15
- "build": "tsc && tsc-alias"
16
- },
17
- "devDependencies": {
18
- "@wxn0brp/falcon-frame": "^0.5.3",
19
- "@types/bun": "*",
20
- "@types/ws": "^8.18.1",
21
- "tsc-alias": "*",
22
- "typescript": "*"
23
- },
24
- "peerDependencies": {
25
- "@wxn0brp/falcon-frame": ">=0.5.3"
26
- },
27
- "peerDependenciesMeta": {
28
- "@wxn0brp/falcon-frame": {
29
- "optional": true
30
- }
31
- },
32
- "dependencies": {
33
- "ws": "^8.18.3"
2
+ "name": "@wxn0brp/gloves-link-server",
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-server.git"
12
+ },
13
+ "homepage": "https://github.com/wxn0brP/GlovesLink",
14
+ "devDependencies": {
15
+ "@wxn0brp/falcon-frame": "^0.5.3",
16
+ "@types/bun": "*",
17
+ "@types/ws": "^8.18.1",
18
+ "tsc-alias": "*",
19
+ "typescript": "*"
20
+ },
21
+ "peerDependencies": {
22
+ "@wxn0brp/falcon-frame": ">=0.5.3"
23
+ },
24
+ "peerDependenciesMeta": {
25
+ "@wxn0brp/falcon-frame": {
26
+ "optional": true
27
+ }
28
+ },
29
+ "dependencies": {
30
+ "ws": "^8.18.3"
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "import": "./dist/index.js",
39
+ "default": "./dist/index.js"
34
40
  },
35
- "files": [
36
- "dist"
37
- ],
38
- "exports": {
39
- ".": {
40
- "types": "./dist/index.d.ts",
41
- "import": "./dist/index.js",
42
- "default": "./dist/index.js"
43
- },
44
- "./*": {
45
- "types": "./dist/*.d.ts",
46
- "import": "./dist/*.js",
47
- "default": "./dist/*.js"
48
- }
41
+ "./*": {
42
+ "types": "./dist/*.d.ts",
43
+ "import": "./dist/*.js",
44
+ "default": "./dist/*.js"
49
45
  }
46
+ }
50
47
  }