@cocreate/socket-server 1.34.0 → 1.35.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 +22 -20
- package/package.json +3 -3
- package/src/index.js +3 -3
|
@@ -9,33 +9,36 @@ jobs:
|
|
|
9
9
|
about:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
11
|
steps:
|
|
12
|
-
- name: Checkout
|
|
13
|
-
uses: actions/checkout@
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
- name: Checkout repository
|
|
13
|
+
uses: actions/checkout@v7
|
|
14
|
+
|
|
15
|
+
- name: Sync package.json description to GitHub About
|
|
16
|
+
env:
|
|
17
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB }}
|
|
18
|
+
run: |
|
|
19
|
+
DESC=$(jq -r '.description // empty' package.json)
|
|
20
|
+
if [ -n "$DESC" ]; then
|
|
21
|
+
echo "Updating repository description to: $DESC"
|
|
22
|
+
gh api -X PATCH repos/${{ github.repository }} -f description="$DESC"
|
|
23
|
+
else
|
|
24
|
+
echo "No description found in package.json."
|
|
25
|
+
fi
|
|
23
26
|
|
|
24
27
|
release:
|
|
25
28
|
runs-on: ubuntu-latest
|
|
26
29
|
steps:
|
|
27
|
-
- name: Checkout
|
|
28
|
-
uses: actions/checkout@
|
|
30
|
+
- name: Checkout repository
|
|
31
|
+
uses: actions/checkout@v7
|
|
29
32
|
with:
|
|
30
|
-
fetch-depth: 0
|
|
33
|
+
fetch-depth: 0
|
|
34
|
+
token: ${{ secrets.GITHUB }} # Authenticates git CLI for tag/commit pushes
|
|
31
35
|
|
|
32
36
|
- name: Setup Node.js
|
|
33
|
-
uses: actions/setup-node@
|
|
37
|
+
uses: actions/setup-node@v7
|
|
34
38
|
with:
|
|
35
|
-
node-version:
|
|
39
|
+
node-version: '24'
|
|
36
40
|
|
|
37
41
|
- name: Install Semantic Release & Plugins
|
|
38
|
-
# Installs semantic-release and its plugins on the runner
|
|
39
42
|
run: |
|
|
40
43
|
npm install -g semantic-release \
|
|
41
44
|
@semantic-release/changelog \
|
|
@@ -43,12 +46,11 @@ jobs:
|
|
|
43
46
|
@semantic-release/github \
|
|
44
47
|
@semantic-release/git
|
|
45
48
|
|
|
46
|
-
- name: Run Semantic Release
|
|
49
|
+
- name: Run Semantic Release
|
|
47
50
|
id: semantic
|
|
48
|
-
# This will automatically pick up your export default config file in the repository root
|
|
49
51
|
run: npx semantic-release
|
|
50
52
|
env:
|
|
51
|
-
GITHUB_TOKEN: "${{ secrets.
|
|
53
|
+
GITHUB_TOKEN: "${{ secrets.GITHUB }}"
|
|
52
54
|
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
|
53
55
|
|
|
54
56
|
outputs:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/socket-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.1",
|
|
4
4
|
"description": "High-density multi-tenant WebSocket orchestration server for real-time state synchronization and cluster-mesh collaboration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"websocket-server",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://cocreate.app/docs/CoCreate-socket-server",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@cocreate/config": "^1.
|
|
37
|
-
"@cocreate/utils": "^1.
|
|
36
|
+
"@cocreate/config": "^1.16.0",
|
|
37
|
+
"@cocreate/utils": "^1.46.0",
|
|
38
38
|
"ws": "^8.21.1"
|
|
39
39
|
}
|
|
40
40
|
}
|
package/src/index.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
// For details, visit <https://cocreate.app/licenses/> or contact us at sales@cocreate.app.
|
|
22
22
|
|
|
23
23
|
import { EventEmitter } from 'node:events';
|
|
24
|
-
import { WebSocketServer } from 'ws';
|
|
24
|
+
import { WebSocket, WebSocketServer } from 'ws';
|
|
25
25
|
import { URL } from 'node:url';
|
|
26
26
|
import { uuid } from '@cocreate/utils';
|
|
27
27
|
import Config from '@cocreate/config';
|
|
@@ -79,7 +79,7 @@ export class SocketServer extends EventEmitter {
|
|
|
79
79
|
}
|
|
80
80
|
socket.isAlive = false;
|
|
81
81
|
try {
|
|
82
|
-
if (socket.readyState ===
|
|
82
|
+
if (socket.readyState === WebSocket.OPEN) {
|
|
83
83
|
socket.ping();
|
|
84
84
|
} else {
|
|
85
85
|
socket.terminate();
|
|
@@ -826,7 +826,7 @@ export class SocketServer extends EventEmitter {
|
|
|
826
826
|
// Helper to send payloads safely on valid connections without throwing frame failures
|
|
827
827
|
_safeSend(socket, payload) {
|
|
828
828
|
try {
|
|
829
|
-
if (socket && socket.readyState ===
|
|
829
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
830
830
|
const message = typeof payload === "string" ? payload : JSON.stringify(payload);
|
|
831
831
|
socket.send(message);
|
|
832
832
|
}
|