aboutsummaryrefslogtreecommitdiff
path: root/src/modules/users.js
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2019-12-10 21:30:27 +0200
committerHenry Jameson <me@hjkos.com>2019-12-10 21:30:27 +0200
commit6acd889589e46b18491d96b5fa992154b4e58d88 (patch)
treedebcdf1551aa869703bc032ee57b55266e8bc788 /src/modules/users.js
parent505fb260610e557e27bbc5d27515337ea07e0e3e (diff)
Option to enable streaming
Diffstat (limited to 'src/modules/users.js')
-rw-r--r--src/modules/users.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/modules/users.js b/src/modules/users.js
index 6bdaf193..cbec6063 100644
--- a/src/modules/users.js
+++ b/src/modules/users.js
@@ -469,14 +469,22 @@ const users = {
store.dispatch('initializeSocket')
}
- store.dispatch('startMastoUserSocket').catch((error) => {
- console.error('Failed initializing MastoAPI Streaming socket', error)
+ const startPolling = () => {
// Start getting fresh posts.
store.dispatch('startFetchingTimeline', { timeline: 'friends' })
// Start fetching notifications
store.dispatch('startFetchingNotifications')
- })
+ }
+
+ if (store.getters.mergedConfig.useStreamingApi) {
+ store.dispatch('enableMastoSockets').catch((error) => {
+ console.error('Failed initializing MastoAPI Streaming socket', error)
+ startPolling()
+ })
+ } else {
+ startPolling()
+ }
// Get user mutes
store.dispatch('fetchMutes')