-
Notifications
You must be signed in to change notification settings - Fork 80
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
Fix event subscription and improve Counter example #1008
Fix event subscription and improve Counter example #1008
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked it locally and it seems to work fine 👍.
Some questions:
- changing online URL to local url (see comment below)?
- for events: Once subscribed again it remembers the "old" payload while the event count is set back to zero: I think the payload should be also nulled. What do you think?
- How can we add a test to avoid regressions in the future?
d8a7bd1
to
18af484
Compare
I reviewed the updated code and I noticed that I left a couple of |
About the |
I don't see any reason not to update 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it looks good but I still have the questions below (as raised before)
- for events: Once subscribed again it remembers the "old" payload while the event count is set back to zero: I think the payload should be also nulled. What do you think?
- How can we add a test to avoid regressions in the future?
Also: - Better UI in the example - Fixed a glitch in binding-http server
db6c574
to
3eb59de
Compare
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## master #1008 +/- ##
=======================================
Coverage 75.79% 75.79%
=======================================
Files 72 72
Lines 14856 14871 +15
Branches 1429 1428 -1
=======================================
+ Hits 11260 11272 +12
- Misses 3563 3566 +3
Partials 33 33
|
I should revert back to an empty string here. Is that ok? More info on #973. With the current changes the memory leak is fixed for the first subscription but the problem arise again if you follow these steps:
I think this is due to the fact that here the server response is reused and the client keep it open. I have to investigate more. |
It would be nice to have something similar to what |
use `close` event instead of finish to detect unsubscriptions. Close event is also called when the client abort the connection. `finish` is only called when the client consume the response and close the connection.
In playground, we use playwright to test the interface: https://github.com/thingweb/thingweb-playground/blob/master/packages/web/test.js . It works pretty well and has a quite simplistic way to program the tests. Nothing against karma, just one alternative. |
👍 |
0b92aa8
to
b4d786f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR should eventually fix #1005 and might solve #973 as well. Moreover, I wanted to improve a little bit the UI in the counter-example to give users small feedback when events occur. Everything is still draft because I need to clean up the code, the commit log, and typescript typings. Other than that it should work and people can try it.