Added SocketManager, SubscriptionStore, Subscription, VisibilitySocketManager an…
What does this MR do?
Frontend for sockets proposal starting here: https://gitlab.com/gitlab-org/gitlab-workhorse/merge_requests/164
Added SocketManager
to manage the single socket and to provide an interface to subscribe/unsubscribe and hook into realtime updates.
Added SubscriptionStore
to track all subscriptions so we can unsubscribeAll
and subscribeAll
.
Added Subscription
to classify and encapsulate the properties/actions of a specific subscription.
Added VisibilitySocketManager
to extend SocketManager
and provide the ability to unsubscribeAll
and subscribeAll
on visibilitychange
.
Note:
This does lack the concept of notificationCallback
, it could be added, but the case I saw, it was using it to trigger a spinner everytime a request was being made, so the user could know. Well, the whole point of sockets is to not have an explicit start to that wait for a request, so UX should probably look at our loading UX for sockets specifically.
Other than this, it is a complete replacement for Poll
.
Are there points in the code the reviewer needs to double check?
Why was this MR needed?
Screenshots (if relevant)
Does this MR meet the acceptance criteria?
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together