@discordeno/gateway 18.0.0-next.ad17926

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 ADDED
@@ -0,0 +1,61 @@
1
+ # Standalone WS / Proxy WS
2
+
3
+ This WS service is meant for ADVANCED DEVELOPERS ONLY!
4
+
5
+ ## Benefits
6
+
7
+ - **Zero Downtime Updates**:
8
+
9
+ - Your bot can be updated in a matter of seconds. With normal sharding, you have to restart which also has to process
10
+ identifying all your shards with a 1/~5s rate limit. With WS handling moved to a proxy process, this allows you to
11
+ instantly get the bot code restarted without any concerns of delays. If you have a bot on 200,000 servers normally
12
+ this would mean a 20 minute delay to restart your bot if you made a small change and restarted.
13
+
14
+ - **Zero Downtime Resharding**:
15
+
16
+ - Discord stops letting your bot get added to new servers at certain points in time. For example, suppose you had
17
+ 150,000 servers running 150 shards. The maximum amount of servers your shards could hold is 150 \* 2500 = 375,000.
18
+ If your bot reaches this, it can no longer join new servers until it re-shards.
19
+ - DD proxy provides 2 types of re-sharding. Automated and manual. You can also have both.
20
+ - `Automated`: This system will automatically begin a Zero-downtime resharding process behind the scenes when you
21
+ reach 80% of your maximum servers allowed by your shards. For example, since 375,000 was the max, at 300,000 we
22
+ would begin re-sharding behind the scenes with `ZERO DOWNTIME`.
23
+ - 80% of maximum servers reached (The % of 80% is customizable.)
24
+ - Identify limits have room to allow re-sharding. (Also customizable)
25
+ - `Manual`: You can also trigger this manually should you choose.
26
+
27
+ - **Horizontal Scaling**:
28
+
29
+ - The proxy system allows you to scale the bot horizontally. When you reach a huge size, you can either keep spending
30
+ more money to keep beefing up your server or you can buy several cheaper servers and scale horizontally. The proxy
31
+ means you can have WS handling on a completely separate system.
32
+
33
+ - **No Loss Restarts**:
34
+
35
+ - When you restart a bot without the proxy system, normally you would lose many events. Users may be using commands or
36
+ messages are sent that will not be filtered. As your bot's grow this number rises dramatically. Users may join who
37
+ wont get the auto-roles or any other actions your bot should take. With the proxy system, you can keep restarting
38
+ your bot and never lose any events. Events will be put into a queue while your bot is down(max size of queue is
39
+ customizable), once the bot is available the queue will begin processing all events.
40
+
41
+ - **Controllers**:
42
+
43
+ - The controller aspect gives you full control over everything inside the proxy. You can provide a function to simply
44
+ override the handler. For example, if you would like a certain function to do something different, instead of having
45
+ to fork and maintain your fork, you can just provide a function to override.
46
+
47
+ - **Clustering With Workers**:
48
+ - Take full advantage of all your CPU cores by using workers to spread the load. Control how many shards per worker
49
+ and how many workers to maximize efficiency!
50
+
51
+ ## Usage
52
+
53
+ ```ts
54
+ createGatewayManager({
55
+ // TODO: (docs) Fill this out
56
+ });
57
+ ```
58
+
59
+ ## API/Docs
60
+
61
+ // TODO: (docs) Fill this out. List all props/methods.
@@ -0,0 +1,6 @@
1
+ export * from '@discordeno/types';
2
+ export * from '@discordeno/utils';
3
+ export * from './manager/index.js';
4
+ export * from './shard/index.js';
5
+ export * from './utils/index.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export*from"@discordeno/types";export*from"@discordeno/utils";export*from"./manager/index.js";export*from"./shard/index.js";export*from"./utils/index.js";
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICdAZGlzY29yZGVuby90eXBlcydcbmV4cG9ydCAqIGZyb20gJ0BkaXNjb3JkZW5vL3V0aWxzJ1xuZXhwb3J0ICogZnJvbSAnLi9tYW5hZ2VyL2luZGV4LmpzJ1xuZXhwb3J0ICogZnJvbSAnLi9zaGFyZC9pbmRleC5qcydcbmV4cG9ydCAqIGZyb20gJy4vdXRpbHMvaW5kZXguanMnXG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsV0FBYyxtQkFBbUIsQUFDakMsWUFBYyxtQkFBbUIsQUFDakMsWUFBYyxvQkFBb0IsQUFDbEMsWUFBYyxrQkFBa0IsQUFDaEMsWUFBYyxrQkFBa0IifQ==
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@discordeno/gateway",
3
+ "version": "18.0.0-next.ad17926",
4
+ "main": "./dist/index.js",
5
+ "types": "./dist/index.d.ts",
6
+ "type": "module",
7
+ "license": "Apache-2.0",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/discordeno/discordeno.git"
11
+ },
12
+ "scripts": {
13
+ "build": "swc src --out-dir dist",
14
+ "build:type": "tsc --declaration --emitDeclarationOnly --declarationDir dist",
15
+ "release-build": "yarn build && yarn build:type",
16
+ "fmt": "prettier -w ./src",
17
+ "lint": "eslint \"src/**/*.ts*\"",
18
+ "test:unit": "c8 mocha --no-warnings 'tests/**/*.spec.ts'",
19
+ "test:unit:watch": "mocha --no-warnings --watch --parallel 'tests/**/*.spec.ts'",
20
+ "test:type": "tsc --noEmit",
21
+ "test:test-type": "tsc --project tsconfig.test.json"
22
+ },
23
+ "devDependencies": {
24
+ "@discordeno/types": "18.0.0-alpha.1",
25
+ "@discordeno/utils": "18.0.0-alpha.1",
26
+ "@swc/cli": "^0.1.57",
27
+ "@swc/core": "^1.3.21",
28
+ "@types/chai": "^4",
29
+ "@types/mocha": "^10",
30
+ "@types/node": "^18.11.9",
31
+ "@types/sinon": "^10.0.13",
32
+ "@types/ws": "^8.5.3",
33
+ "c8": "^7.12.0",
34
+ "chai": "^4.3.7",
35
+ "eslint": "^8.0.1",
36
+ "eslint-config-discordeno": "*",
37
+ "mocha": "^10.1.0",
38
+ "sinon": "^15.0.0",
39
+ "tsconfig": "*",
40
+ "typescript": "^4.9.3"
41
+ },
42
+ "dependencies": {
43
+ "ws": "^8.11.0"
44
+ }
45
+ }