fix: use fibonacci instead of exponential when streaming (#1205)

I dunno if this will improve #14, but it at least aligns us with Mastodon's behavior.
This commit is contained in:
Nolan Lawson 2019-05-10 21:05:26 -07:00 committed by GitHub
parent b7b9758445
commit 89a56678e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -71,7 +71,7 @@ export class TimelineStream {
_setupWebSocket () { _setupWebSocket () {
const url = getUrl(this._streamingApi, this._accessToken, this._timeline) const url = getUrl(this._streamingApi, this._accessToken, this._timeline)
const ws = new WebSocketClient(url, null, { backoff: 'exponential' }) const ws = new WebSocketClient(url, null, { backoff: 'fibonacci' })
ws.onopen = this._opts.onOpen || noop ws.onopen = this._opts.onOpen || noop
ws.onmessage = this._opts.onMessage ? e => this._opts.onMessage(JSON.parse(e.data)) : noop ws.onmessage = this._opts.onMessage ? e => this._opts.onMessage(JSON.parse(e.data)) : noop