Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(websocket-plugin): get rid off rxjs/webSocket and use WebSocket directly #2033

Merged
merged 2 commits into from
Sep 15, 2023

Conversation

arturovt
Copy link
Member

@arturovt arturovt commented Jul 11, 2023

This commit updated the WebSocket handler implementation and switched to
using the native WebSocket directly, instead of relying on rxjs/webSocket.
The RxJS WebSocket implementation can be cumbersome when it comes to handling
socket events and lacks simplicity. By handling socket events manually, we avoid
the need to use the RxJS implementation.

@bundlemon
Copy link

bundlemon bot commented Jul 11, 2023

BundleMon

Unchanged files (3)
Status Path Size Limits
fesm2015/ngxs-store.js
94.14KB 125KB / +0.5%
fesm2015/ngxs-store-operators.js
6.23KB 15KB / +0.5%
fesm2015/ngxs-store-internals.js
3.57KB 20KB / +0.5%

No change in files bundle size

Unchanged groups (3)
Status Path Size Limits
@ngxs/store(esm2015)[gzip]
./esm2015/**/*.js
179.87KB +1%
@ngxs/store(umd)[gzip]
./bundles/*.umd.js
36.45KB +1%
@ngxs/store(fesm2015)[gzip]
./fesm2015/*.js
24.95KB +1%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@bundlemon
Copy link

bundlemon bot commented Jul 11, 2023

BundleMon (NGXS Plugins)

Files updated (2)
Status Path Size Limits
Plugins(fesm2015)[gzip]
websocket-plugin/fesm2015/ngxs-websocket-plug
in.js
2.64KB (+123B +4.77%) +1%
Plugins(umd)[gzip]
websocket-plugin/bundles/ngxs-websocket-plugi
n.umd.js
6.91KB (+119B +1.71%) +1%
Unchanged files (14)
Status Path Size Limits
Plugins(umd)[gzip]
storage-plugin/bundles/ngxs-storage-plugin.um
d.js
7.97KB +1%
Plugins(umd)[gzip]
router-plugin/bundles/ngxs-router-plugin.umd.
js
7.19KB +1%
Plugins(umd)[gzip]
hmr-plugin/bundles/ngxs-hmr-plugin.umd.js
6.89KB +1%
Plugins(fesm2015)[gzip]
storage-plugin/fesm2015/ngxs-storage-plugin.j
s
3.7KB +1%
Plugins(umd)[gzip]
form-plugin/bundles/ngxs-form-plugin.umd.js
3.29KB +1%
Plugins(fesm2015)[gzip]
router-plugin/fesm2015/ngxs-router-plugin.js
2.92KB +1%
Plugins(umd)[gzip]
devtools-plugin/bundles/ngxs-devtools-plugin.
umd.js
2.75KB +1%
Plugins(fesm2015)[gzip]
hmr-plugin/fesm2015/ngxs-hmr-plugin.js
2.65KB +1%
Plugins(fesm2015)[gzip]
form-plugin/fesm2015/ngxs-form-plugin.js
2.57KB +1%
Plugins(umd)[gzip]
logger-plugin/bundles/ngxs-logger-plugin.umd.
js
2.53KB +1%
Plugins(fesm2015)[gzip]
devtools-plugin/fesm2015/ngxs-devtools-plugin
.js
2.17KB +1%
Plugins(fesm2015)[gzip]
logger-plugin/fesm2015/ngxs-logger-plugin.js
2.01KB +1%
Plugins(umd)[gzip]
router-plugin/bundles/ngxs-router-plugin-inte
rnals.umd.js
654B +1%
Plugins(fesm2015)[gzip]
router-plugin/fesm2015/ngxs-router-plugin-int
ernals.js
406B +1%

Total files change +242B +0.41%

Groups updated (3)
Status Path Size Limits
All Plugins(esm2015)[gzip]
./-plugin/esm2015/**/.js
109.82KB (+780B +0.7%) +1%
All Plugins(fesm2015)[gzip]
./-plugin/fesm2015/.js
19.05KB (+123B +0.63%) +1%
All Plugins(umd)[gzip]
./-plugin/bundles/.umd.js
38.17KB (+119B +0.31%) +1%

Final result: ❌

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@bundlemon
Copy link

bundlemon bot commented Jul 11, 2023

BundleMon (Integration Projects)

Files updated (1)
Status Path Size Limits
Main bundles(Gzip)
hello-world-ng15/dist-integration/main.(hash)
.js
63.38KB (-578B -0.88%) +1%

Total files change -578B -0.88%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@nx-cloud
Copy link

nx-cloud bot commented Jul 11, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 8fa8bf7. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 3 targets

Sent with 💌 from NxCloud.

@arturovt arturovt force-pushed the refactor/web-socket branch 2 times, most recently from b611209 to 91eb94a Compare July 13, 2023 20:02
@arturovt arturovt marked this pull request as ready for review July 13, 2023 20:02
Copy link
Member

@markwhitfeld markwhitfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make sure that we test and handle correctly the scenario where the connect method is called after the service is destroyed.

packages/websocket-plugin/src/websocket-handler.ts Outdated Show resolved Hide resolved
Copy link
Member

@markwhitfeld markwhitfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still prefer to have the _destroy$ changed to a ReplaySubject just so that we are consistent with a recommended practice. But I'll leave it up to you on what you do.
Also, can you resolve the conflicts with master?
I tried, but saw that it was reintroducing the initialiser code that you removed. Best that you do it 👍

…Socket` directly

This commit updated the WebSocket handler implementation and switched to
using the native `WebSocket` directly, instead of relying on `rxjs/webSocket`.
The RxJS WebSocket implementation can be cumbersome when it comes to handling
socket events and lacks simplicity. By handling socket events manually, we avoid
the need to use the RxJS implementation.
@codeclimate
Copy link

codeclimate bot commented Sep 15, 2023

Code Climate has analyzed commit 8fa8bf7 and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 2

The test coverage on the diff in this pull request is 86.4% (50% is the threshold).

This pull request will bring the total coverage in the repository to 95.5% (0.0% change).

View more on Code Climate.

@arturovt arturovt merged commit 4a74d16 into master Sep 15, 2023
8 checks passed
@arturovt arturovt deleted the refactor/web-socket branch September 15, 2023 16:22
@markwhitfeld markwhitfeld added this to the v.18.0.0 milestone Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants