Skip to content

Instantly share code, notes, and snippets.

@sb8244
Created September 11, 2019 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sb8244/4e077cfb850c14d1aa2a5c36909bf08b to your computer and use it in GitHub Desktop.
Save sb8244/4e077cfb850c14d1aa2a5c36909bf08b to your computer and use it in GitHub Desktop.
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