@cocreate/socket-server 1.22.0 → 1.24.0
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/CHANGELOG.md +24 -0
- package/README.md +22 -9
- package/package.json +4 -4
- package/src/index.js +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
# [1.24.0](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.23.0...v1.24.0) (2023-11-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* update licensing details ([e105a05](https://github.com/CoCreate-app/CoCreate-socket-server/commit/e105a05f3d5c9a0f889a99f4cf8f086c46c93679))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* upgrade dependencies for latest features and fixes ([33f5073](https://github.com/CoCreate-app/CoCreate-socket-server/commit/33f50737ff478d1147ea183e2fa058d5dc8dca35))
|
|
12
|
+
|
|
13
|
+
# [1.23.0](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.22.0...v1.23.0) (2023-11-25)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* userStatus across various clientid ([507d5e5](https://github.com/CoCreate-app/CoCreate-socket-server/commit/507d5e5b7e17a6aadb6b1b4522b8f753d0156715))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* upgrade dependencies for latest features and fixes ([5176e69](https://github.com/CoCreate-app/CoCreate-socket-server/commit/5176e69558a57af55d003608fb24515103877edd))
|
|
24
|
+
|
|
1
25
|
# [1.22.0](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.21.11...v1.22.0) (2023-11-19)
|
|
2
26
|
|
|
3
27
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# CoCreate-socket-server
|
|
2
|
+
|
|
2
3
|
A simple socket-server component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API. Take it for a spin in our [playground!](https://cocreate.app/docs/socket-server)
|
|
3
4
|
|
|
4
5
|

|
|
@@ -16,25 +17,27 @@ We appreciate your continued support, thank you!
|
|
|
16
17
|
|
|
17
18
|
# Table of Contents
|
|
18
19
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
20
|
+
- [Table of Contents](#table-of-contents)
|
|
21
|
+
- [Announcements](#announcements)
|
|
22
|
+
- [Roadmap](#roadmap)
|
|
23
|
+
- [How to Contribute](#how-to-contribute)
|
|
24
|
+
- [About](#about)
|
|
25
|
+
- [License](#license)
|
|
25
26
|
|
|
26
27
|
<a name="announcements"></a>
|
|
28
|
+
|
|
27
29
|
# Announcements
|
|
28
30
|
|
|
29
|
-
All updates to this library are documented in our [CHANGELOG](https://github.com/CoCreate-app/CoCreate-socket-server/blob/master/CHANGELOG.md) and [releases](https://github.com/CoCreate-app/CoCreate-socket-server/releases). You may also subscribe to email for releases and breaking changes.
|
|
31
|
+
All updates to this library are documented in our [CHANGELOG](https://github.com/CoCreate-app/CoCreate-socket-server/blob/master/CHANGELOG.md) and [releases](https://github.com/CoCreate-app/CoCreate-socket-server/releases). You may also subscribe to email for releases and breaking changes.
|
|
30
32
|
|
|
31
33
|
<a name="roadmap"></a>
|
|
34
|
+
|
|
32
35
|
# Roadmap
|
|
33
36
|
|
|
34
37
|
If you are interested in the future direction of this project, please take a look at our open [issues](https://github.com/CoCreate-app/CoCreate-socket-server/issues) and [pull requests](https://github.com/CoCreate-app/CoCreate-socket-server/pulls). We would love to hear your feedback.
|
|
35
38
|
|
|
36
|
-
|
|
37
39
|
<a name="about"></a>
|
|
40
|
+
|
|
38
41
|
# About
|
|
39
42
|
|
|
40
43
|
CoCreate-socket-server is guided and supported by the CoCreate Developer Experience Team.
|
|
@@ -44,9 +47,19 @@ Please Email the Developer Experience Team [here](mailto:develop@cocreate.app) i
|
|
|
44
47
|
CoCreate-socket-server is maintained and funded by CoCreate. The names and logos for CoCreate are trademarks of CoCreate, LLC.
|
|
45
48
|
|
|
46
49
|
<a name="contribute"></a>
|
|
50
|
+
|
|
47
51
|
# How to Contribute
|
|
48
52
|
|
|
49
53
|
We encourage contribution to our libraries (you might even score some nifty swag), please see our [CONTRIBUTING](https://github.com/CoCreate-app/CoCreate-socket-server/blob/master/CONTRIBUTING.md) guide for details.
|
|
50
54
|
|
|
55
|
+
<a name="license"></a>
|
|
56
|
+
|
|
51
57
|
# License
|
|
52
|
-
|
|
58
|
+
|
|
59
|
+
This software is dual-licensed under the GNU Affero General Public License version 3 (AGPLv3) and a commercial license.
|
|
60
|
+
|
|
61
|
+
- **Open Source Use**: For open-source projects and non-commercial use, this software is available under the AGPLv3. The AGPLv3 allows you to freely use, modify, and distribute this software, provided that all modifications and derivative works are also licensed under the AGPLv3. For the full license text, see the [LICENSE file](https://github.com/CoCreate-app/CoCreate-socket-server/blob/master/LICENSE).
|
|
62
|
+
|
|
63
|
+
- **Commercial Use**: For-profit companies and individuals intending to use this software for commercial purposes must obtain a commercial license. The commercial license is available when you sign up for an API key on our [website](https://cocreate.app). This license permits proprietary use and modification of the software without the copyleft requirements of the AGPLv3. It is ideal for integrating this software into proprietary commercial products and applications.
|
|
64
|
+
|
|
65
|
+
If you have not purchased a commercial license and intend to use this software for commercial purposes, you are required to sign up for an API key on our website.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/socket-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "CoCreate-socket-server",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cocreate-socket",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://cocreate.app/docs/CoCreate-socket-server",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@cocreate/config": "^1.
|
|
44
|
-
"@cocreate/uuid": "^1.
|
|
45
|
-
"@cocreate/utils": "^1.
|
|
43
|
+
"@cocreate/config": "^1.8.0",
|
|
44
|
+
"@cocreate/uuid": "^1.9.0",
|
|
45
|
+
"@cocreate/utils": "^1.29.0",
|
|
46
46
|
"ws": "7.5.9"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/src/index.js
CHANGED
|
@@ -88,7 +88,7 @@ class SocketServer extends EventEmitter {
|
|
|
88
88
|
|
|
89
89
|
if (self.authenticate) {
|
|
90
90
|
const { user_id, expires } = self.authenticate.decodeToken(options.token)
|
|
91
|
-
const userStatus = { socket, method: 'userStatus', user_id: options.user_id, userStatus: 'off', organization_id }
|
|
91
|
+
const userStatus = { socket, method: 'userStatus', user_id: options.user_id, clientId: options.clientId, userStatus: 'off', organization_id }
|
|
92
92
|
if (user_id) {
|
|
93
93
|
options.user_id = user_id
|
|
94
94
|
socket.user_id = user_id;
|
|
@@ -181,7 +181,7 @@ class SocketServer extends EventEmitter {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
if (socket.user_id) {
|
|
184
|
-
this.emit('userStatus', { socket, user_id: socket.user_id, userStatus: 'on', organization_id });
|
|
184
|
+
this.emit('userStatus', { socket, user_id: socket.user_id, clientId: socket.clientId, userStatus: 'on', organization_id });
|
|
185
185
|
let user = this.users.get(socket.user_id)
|
|
186
186
|
|
|
187
187
|
if (!Array.isArray(user)) {
|
|
@@ -298,7 +298,7 @@ class SocketServer extends EventEmitter {
|
|
|
298
298
|
clearTimeout(userDebounceTimer);
|
|
299
299
|
userDebounceTimer = setTimeout(() => {
|
|
300
300
|
this.users.delete(socket.user_id);
|
|
301
|
-
this.emit('userStatus', { socket, user_id: socket.user_id, userStatus: 'off', organization_id });
|
|
301
|
+
this.emit('userStatus', { socket, user_id: socket.user_id, clientId: socket.clientId, userStatus: 'off', organization_id });
|
|
302
302
|
}, 10000);
|
|
303
303
|
|
|
304
304
|
this.users.set(socket.user_id, userDebounceTimer)
|
|
@@ -333,8 +333,13 @@ class SocketServer extends EventEmitter {
|
|
|
333
333
|
console.log('data.method: ', data.method)
|
|
334
334
|
|
|
335
335
|
if (socket.user_id && socket.expires && new Date(new Date().toISOString()).getTime() >= socket.expires) {
|
|
336
|
+
// data.error = 'Token expired'
|
|
337
|
+
// socket.send(JSON.stringify(data))
|
|
338
|
+
await this.send({
|
|
339
|
+
socket, method: 'updateUserStatus', user_id: socket.user_id, clientId: data.clientId, userStatus: 'off', socketId: data.socketId, organization_id
|
|
340
|
+
})
|
|
336
341
|
socket.user_id = socket.expires = null
|
|
337
|
-
|
|
342
|
+
return
|
|
338
343
|
}
|
|
339
344
|
|
|
340
345
|
if (this.authorize) {
|