@cocreate/socket-server 1.15.0 → 1.15.1
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/.github/workflows/automated.yml +70 -83
- package/CHANGELOG.md +10 -0
- package/docs/index.html +1 -1
- package/package.json +1 -1
- package/src/index.js +12 -21
|
@@ -1,83 +1,70 @@
|
|
|
1
|
-
name: Automated
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
jobs:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
# steps:
|
|
72
|
-
# - name: Checkout
|
|
73
|
-
# uses: actions/checkout@v3
|
|
74
|
-
# - name: setup nodejs
|
|
75
|
-
# uses: actions/setup-node@v3
|
|
76
|
-
# with:
|
|
77
|
-
# node-version: 16
|
|
78
|
-
# - name: update documentation
|
|
79
|
-
# uses: CoCreate-app/CoCreate-docs@master
|
|
80
|
-
# env:
|
|
81
|
-
# organization_id: ${{ secrets.COCREATE_ORGANIZATION_ID }}
|
|
82
|
-
# key: ${{ secrets.COCREATE_KEY }}
|
|
83
|
-
# host: ${{ secrets.COCREATE_HOST }}
|
|
1
|
+
name: Automated Workflow
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- master
|
|
6
|
+
jobs:
|
|
7
|
+
about:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
steps:
|
|
10
|
+
- name: Checkout
|
|
11
|
+
uses: actions/checkout@v3
|
|
12
|
+
- name: Setup Node.js
|
|
13
|
+
uses: actions/setup-node@v3
|
|
14
|
+
with:
|
|
15
|
+
node-version: 16
|
|
16
|
+
- name: Jaid/action-sync-node-meta
|
|
17
|
+
uses: jaid/action-sync-node-meta@v1.4.0
|
|
18
|
+
with:
|
|
19
|
+
direction: overwrite-github
|
|
20
|
+
githubToken: "${{ secrets.GITHUB }}"
|
|
21
|
+
release:
|
|
22
|
+
runs-on: ubuntu-latest
|
|
23
|
+
steps:
|
|
24
|
+
- name: Checkout
|
|
25
|
+
uses: actions/checkout@v3
|
|
26
|
+
- name: Setup Node.js
|
|
27
|
+
uses: actions/setup-node@v3
|
|
28
|
+
with:
|
|
29
|
+
node-version: 14
|
|
30
|
+
- name: Semantic Release
|
|
31
|
+
uses: cycjimmy/semantic-release-action@v3
|
|
32
|
+
id: semantic
|
|
33
|
+
with:
|
|
34
|
+
extra_plugins: |
|
|
35
|
+
@semantic-release/changelog
|
|
36
|
+
@semantic-release/git
|
|
37
|
+
@semantic-release/github
|
|
38
|
+
env:
|
|
39
|
+
GITHUB_TOKEN: "${{ secrets.GITHUB }}"
|
|
40
|
+
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
|
41
|
+
outputs:
|
|
42
|
+
new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
|
|
43
|
+
new_release_version: "${{ steps.semantic.outputs.new_release_version }}"
|
|
44
|
+
upload:
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
needs: release
|
|
47
|
+
if: needs.release.outputs.new_release_published == 'true'
|
|
48
|
+
env:
|
|
49
|
+
VERSION: "${{ needs.release.outputs.new_release_version }}"
|
|
50
|
+
steps:
|
|
51
|
+
- name: Checkout
|
|
52
|
+
uses: actions/checkout@v3
|
|
53
|
+
- name: Setup Node.js
|
|
54
|
+
uses: actions/setup-node@v3
|
|
55
|
+
with:
|
|
56
|
+
node-version: 16
|
|
57
|
+
- name: Set npm registry auth
|
|
58
|
+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
59
|
+
- name: Install dependencies
|
|
60
|
+
run: yarn install
|
|
61
|
+
- name: Build
|
|
62
|
+
run: yarn build
|
|
63
|
+
- name: Set Environment Variables
|
|
64
|
+
run: |
|
|
65
|
+
echo "organization_id=${{ secrets.COCREATE_ORGANIZATION_ID }}" >> $GITHUB_ENV
|
|
66
|
+
echo "key=${{ secrets.COCREATE_KEY }}" >> $GITHUB_ENV
|
|
67
|
+
echo "host=${{ secrets.COCREATE_HOST }}" >> $GITHUB_ENV
|
|
68
|
+
- name: CoCreate Upload
|
|
69
|
+
run: coc upload
|
|
70
|
+
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [1.15.1](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.15.0...v1.15.1) (2023-08-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* /dist/CoCreate.js updated to https://CoCreate.app/dist/CoCreate.js ([2f991c6](https://github.com/CoCreate-app/CoCreate-socket-server/commit/2f991c61acf8ee5fad4f339603bed9cfe3289deb))
|
|
7
|
+
* replace cdn with /dist ([832ec88](https://github.com/CoCreate-app/CoCreate-socket-server/commit/832ec881cbf7b05d909b7ac4ce7eeb6f7fb95e20))
|
|
8
|
+
* update file uploader ([84f1c51](https://github.com/CoCreate-app/CoCreate-socket-server/commit/84f1c51dd32c88619579a86d30ef149408f471e9))
|
|
9
|
+
* update variable name for better readability ([5415c05](https://github.com/CoCreate-app/CoCreate-socket-server/commit/5415c0559000f116a66bc534a89ca3073e8df1b3))
|
|
10
|
+
|
|
1
11
|
# [1.15.0](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.14.0...v1.15.0) (2023-08-17)
|
|
2
12
|
|
|
3
13
|
|
package/docs/index.html
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -62,25 +62,20 @@ class SocketServer extends EventEmitter {
|
|
|
62
62
|
let organization_id = socket.config.organization_id
|
|
63
63
|
let user_id = socket.config.user_id
|
|
64
64
|
let key = socket.config.key
|
|
65
|
-
let
|
|
66
|
-
if (
|
|
67
|
-
|
|
65
|
+
let clients = this.clients.get(key);
|
|
66
|
+
if (clients) {
|
|
67
|
+
clients.push(socket);
|
|
68
68
|
} else {
|
|
69
|
-
|
|
69
|
+
clients = [socket];
|
|
70
70
|
}
|
|
71
|
-
this.clients.set(key,
|
|
71
|
+
this.clients.set(key, clients);
|
|
72
72
|
|
|
73
73
|
if (user_id)
|
|
74
74
|
this.emit('userStatus', socket, { user_id, userStatus: 'on', organization_id });
|
|
75
75
|
|
|
76
|
-
//. add metrics
|
|
77
|
-
let total_cnt = 0;
|
|
78
|
-
this.clients.forEach((c) => total_cnt += c.length)
|
|
79
|
-
|
|
80
76
|
this.emit("createMetrics", {
|
|
81
77
|
organization_id,
|
|
82
|
-
|
|
83
|
-
total_cnt: total_cnt
|
|
78
|
+
clients: clients.length,
|
|
84
79
|
});
|
|
85
80
|
}
|
|
86
81
|
|
|
@@ -88,14 +83,14 @@ class SocketServer extends EventEmitter {
|
|
|
88
83
|
let organization_id = socket.config.organization_id
|
|
89
84
|
let user_id = socket.config.user_id
|
|
90
85
|
let key = socket.config.key
|
|
91
|
-
let
|
|
92
|
-
const index =
|
|
86
|
+
let clients = this.clients.get(key)
|
|
87
|
+
const index = clients.indexOf(socket);
|
|
93
88
|
|
|
94
89
|
if (index > -1) {
|
|
95
|
-
|
|
90
|
+
clients.splice(index, 1);
|
|
96
91
|
}
|
|
97
92
|
|
|
98
|
-
if (
|
|
93
|
+
if (clients.length == 0) {
|
|
99
94
|
if (user_id)
|
|
100
95
|
this.emit('userStatus', socket, { user_id, status: 'off', organization_id });
|
|
101
96
|
|
|
@@ -104,13 +99,9 @@ class SocketServer extends EventEmitter {
|
|
|
104
99
|
this.emit("deletePermissions", organization_id);
|
|
105
100
|
this.emit('disconnect', organization_id)
|
|
106
101
|
} else {
|
|
107
|
-
|
|
108
|
-
this.clients.forEach((c) => total_cnt += c.length)
|
|
109
|
-
|
|
110
|
-
this.emit("changeCountMetrics", {
|
|
102
|
+
this.emit("updateMetrics", {
|
|
111
103
|
organization_id,
|
|
112
|
-
|
|
113
|
-
client_cnt: room_clients.length
|
|
104
|
+
clients: clients.length
|
|
114
105
|
});
|
|
115
106
|
}
|
|
116
107
|
|