Skip to content

Instantly share code, notes, and snippets.

@jsierles
Created October 31, 2018 09:55
Show Gist options
  • Save jsierles/20bec9131975f6dab3aa61c9c62ab3d2 to your computer and use it in GitHub Desktop.
Save jsierles/20bec9131975f6dab3aa61c9c62ab3d2 to your computer and use it in GitHub Desktop.
import * as Ably from 'ably'
import getConfig from 'next/config'
const { publicRuntimeConfig } = getConfig()
const config = {
authUrl: publicRuntimeConfig.realtimeAuthUrl,
// setting an Authorization header enables withCredentials,
// needed for our cookie auth to the backend
authHeaders: {
authorization: 'none'
},
autoConnect: false,
}
const Realtime = new Ably.Realtime(config)
export default Realtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment