Skip to content

Conversation

Aschen
Copy link
Contributor

@Aschen Aschen commented Aug 10, 2020

What does this PR do?

Convert realtime controller to TS

⚠️ The whole SDK does not works with TS now since we need to convert every exported class

@Aschen Aschen self-assigned this Aug 10, 2020
@Aschen Aschen changed the base branch from master to 7-dev August 10, 2020 08:08
@codecov
Copy link

codecov bot commented Aug 10, 2020

Codecov Report

Merging #537 into 7-dev will decrease coverage by 0.16%.
The diff coverage is 90.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##            7-dev     #537      +/-   ##
==========================================
- Coverage   88.50%   88.34%   -0.17%     
==========================================
  Files          32       32              
  Lines        1427     1441      +14     
  Branches      242      249       +7     
==========================================
+ Hits         1263     1273      +10     
- Misses        117      119       +2     
- Partials       47       49       +2     
Impacted Files Coverage Δ
src/Kuzzle.ts 87.34% <ø> (-0.16%) ⬇️
src/controllers/Document.ts 71.59% <ø> (+0.80%) ⬆️
src/core/Room.js 100.00% <ø> (ø)
src/controllers/Realtime.ts 90.76% <90.76%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae60f66...b1574b2. Read the comment docs.

@Aschen Aschen changed the title Add typescript support realtime 2 Add typescript support realtime Aug 10, 2020
*
* Should be called on network error or disconnection
*/
disconnected () {
Copy link
Contributor

Choose a reason for hiding this comment

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

🤔 can't we make this private/protected, since it's an internal method? Oh, it probably needs to be called by the Protocol class so that might be a reason to leave it public.
Ok, so we have something similar to the "loose-coupling" problem we had in the core.
By the way, the naming of this method looks confusing to me. If it was a handler, I'd call it onDisconnected(), which tells that "what goes in this block gets executed when the connection is closed", which is OK, but I'd prefer the name of the method tells what the method does, i.e. "delete all the subscriptions of this instance of the SDK".
I posted a similar comment on a PR in the core, so I'd like to leave my 2 cents on the naming of this method (if it's not a breaking change)

  • deleteAllSubscriptions()
  • deleteAllRooms()

👋

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I take advantage of existing events and I renamed the methods to saveSubscriptions and resubscribe

export enum ENotificationType {
document = 'document',
user = 'user',
TokenExpired = 'TokenExpired'
Copy link
Contributor

Choose a reason for hiding this comment

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

Why PascalCase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because Kuzzle sent the event like this :(

@Aschen Aschen merged commit 58b6bdb into 7-dev Aug 12, 2020
@Aschen Aschen deleted the add-typescript-support-realtime-2 branch August 12, 2020 10:46
This was referenced Aug 18, 2020
Aschen added a commit that referenced this pull request Aug 18, 2020
# [7.4.0](https://github.com/kuzzleio/sdk-javascript/releases/tag/7.4.0) (2020-08-18)


#### New features

- [ [#542](#542) ] Finalize typescript support   ([Aschen](https://github.com/Aschen))
- [ [#529](#529) ] Add typescript support for protocols   ([Aschen](https://github.com/Aschen))

#### Enhancements

- [ [#541](#541) ] Add meaningful stacktrace   ([Aschen](https://github.com/Aschen))
- [ [#537](#537) ] Add typescript support realtime   ([Aschen](https://github.com/Aschen))
- [ [#531](#531) ] Add typescript support for Index and Collection controllers   ([Aschen](https://github.com/Aschen))
- [ [#530](#530) ] Add typescript support for search results   ([Aschen](https://github.com/Aschen))
- [ [#523](#523) ] Add support for the collection:delete API action   ([morgandruesne](https://github.com/morgandruesne))
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants