diff --git a/src/EventStream.js b/src/EventStream.js index 38fb03e..9b4b860 100644 --- a/src/EventStream.js +++ b/src/EventStream.js @@ -26,10 +26,12 @@ class EventStream extends EventEmitter { const isSecure = protocol === 'https:'; const requestor = isSecure ? https : http; + const nonce = global.performance ? global.performance.now() : 0; const req = requestor.request({ hostname, protocol, - path, + // Firefox has issues making multiple fetch requests with the same parameters so add a nonce + path: `${path}?nonce=${nonce}`, headers: { 'Authorization': `Bearer ${this.token}` }, diff --git a/test/EventStream.spec.js b/test/EventStream.spec.js index 148fc92..02ef0ef 100644 --- a/test/EventStream.spec.js +++ b/test/EventStream.spec.js @@ -49,7 +49,7 @@ describe('EventStream', () => { expect(http.request).to.have.been.calledWith({ hostname: 'hostname', protocol: 'http:', - path: '/path', + path: '/path?nonce=0', headers: { 'Authorization': 'Bearer token' },