diff options
| author | Henry Jameson <me@hjkos.com> | 2019-12-10 21:30:27 +0200 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-12-10 21:30:27 +0200 |
| commit | 6acd889589e46b18491d96b5fa992154b4e58d88 (patch) | |
| tree | debcdf1551aa869703bc032ee57b55266e8bc788 /src/modules/users.js | |
| parent | 505fb260610e557e27bbc5d27515337ea07e0e3e (diff) | |
Option to enable streaming
Diffstat (limited to 'src/modules/users.js')
| -rw-r--r-- | src/modules/users.js | 14 |
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') |
