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

feat(websocket): add ability to remove listener #2027

Open
wants to merge 6 commits into
base: v2
Choose a base branch
from

Conversation

twlite
Copy link
Contributor

@twlite twlite commented Nov 10, 2024

This pr changes listeners array to use a set instead, which prevents addition of duplicated listeners which could possibly lead to memory leaks.

Change listeners array to use a set instead, which prevents addition of duplicated listeners which could possibly lead to memory leaks.
@twlite twlite requested a review from a team as a code owner November 10, 2024 05:17
Copy link
Contributor

github-actions bot commented Nov 11, 2024

Package Changes Through 3fd36ed

There are 11 changes which include upload with minor, upload-js with minor, websocket-js with minor, deep-link with patch, deep-link-js with patch, log-plugin with patch, log-js with patch, fs with patch, fs-js with patch, localhost with minor, sql with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
api-example 2.0.5 2.0.6
api-example-js 2.0.2 2.0.3
deep-link-example-js 2.0.0 2.0.1
deep-link 2.0.1 2.0.2
deep-link-js 2.0.0 2.0.1
fs 2.0.3 2.0.4
fs-js 2.0.2 2.0.3
dialog 2.0.3 2.0.4
http 2.0.3 2.0.4
localhost 2.0.1 2.1.0
log-plugin 2.0.2 2.0.3
log-js 2.0.0 2.0.1
persisted-scope 2.0.3 2.0.4
single-instance 2.0.1 2.0.2
sql 2.0.2 2.0.3
upload 2.1.0 2.2.0
upload-js 2.1.0 2.2.0
websocket-js 2.0.0 2.1.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@FabianLars
Copy link
Member

i agree that a way to remove listeners is needed (that's why i didn't close the issue) but i'm not a fan of the Set here (or how it was used). I can very much imagine that someone wants to register the same function twice for whatever reason. Buuuut i'm totally fine with doing it this way and waiting to see if anyone actually complains.

Also, changing the return value is technically a breaking change but because it didn't return anything before and because this plugin doesn't have that many users i think we can get away with it.

@twlite
Copy link
Contributor Author

twlite commented Nov 14, 2024

Also, changing the return value is technically a breaking change but because it didn't return anything before and because this plugin doesn't have that many users i think we can get away with it.

Yes, that's exactly what I thought 😅

i'm not a fan of the Set here (or how it was used). I can very much imagine that someone wants to register the same function twice for whatever reason.

Yeah but it doesn't make sense to do so because same function gets invoked multiple times which can cause weird behaviors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants