Created
September 11, 2019 18:16
-
-
Save sb8244/4e077cfb850c14d1aa2a5c36909bf08b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pushex } from 'pushex' | |
import { getToken } from './tokenService' | |
const pushexOptions = { | |
getParams: () => getToken().then(({ token }) => Promise.resolve({ token })), | |
onConnectionError: pushex => { | |
pushex.resetParams() | |
}, | |
} | |
const init = () => { | |
const pushexUrl = window.ENV.PUSHEX_URL | |
const PushexClient = new Pushex(pushexUrl, pushexOptions) | |
PushexClient.connect() | |
return PushexClient | |
} | |
export const PushexService = { init } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment