@nestjs/platform-ws 8.1.0 → 8.2.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/CHANGELOG.md +12 -0
- package/adapters/index.js +1 -1
- package/adapters/ws-adapter.js +4 -4
- package/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
<a name="8.2.0"></a>
|
|
7
|
+
# [8.2.0](https://github.com/nestjs/nest/compare/v8.1.2...v8.2.0) (2021-11-08)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @nestjs/platform-ws
|
package/adapters/index.js
CHANGED
package/adapters/ws-adapter.js
CHANGED
|
@@ -24,10 +24,10 @@ class WsAdapter extends websockets_1.AbstractWsAdapter {
|
|
|
24
24
|
this.logger = new common_1.Logger(WsAdapter.name);
|
|
25
25
|
this.httpServersRegistry = new Map();
|
|
26
26
|
this.wsServersRegistry = new Map();
|
|
27
|
-
wsPackage =
|
|
27
|
+
wsPackage = load_package_util_1.loadPackage('ws', 'WsAdapter', () => require('ws'));
|
|
28
28
|
}
|
|
29
29
|
create(port, options) {
|
|
30
|
-
const { server } = options, wsOptions =
|
|
30
|
+
const { server } = options, wsOptions = tslib_1.__rest(options, ["server"]);
|
|
31
31
|
if (wsOptions === null || wsOptions === void 0 ? void 0 : wsOptions.namespace) {
|
|
32
32
|
const error = new Error('"WsAdapter" does not support namespaces. If you need namespaces in your project, consider using the "@nestjs/platform-socket.io" package instead.');
|
|
33
33
|
this.logger.error(error);
|
|
@@ -56,8 +56,8 @@ class WsAdapter extends websockets_1.AbstractWsAdapter {
|
|
|
56
56
|
return wsServer;
|
|
57
57
|
}
|
|
58
58
|
bindMessageHandlers(client, handlers, transform) {
|
|
59
|
-
const close$ =
|
|
60
|
-
const source$ =
|
|
59
|
+
const close$ = rxjs_1.fromEvent(client, constants_1.CLOSE_EVENT).pipe(operators_1.share(), operators_1.first());
|
|
60
|
+
const source$ = rxjs_1.fromEvent(client, 'message').pipe(operators_1.mergeMap(data => this.bindMessageHandler(data, handlers, transform).pipe(operators_1.filter(result => result))), operators_1.takeUntil(close$));
|
|
61
61
|
const onMessage = (response) => {
|
|
62
62
|
if (client.readyState !== READY_STATE.OPEN_STATE) {
|
|
63
63
|
return;
|
package/index.js
CHANGED