client/src/transportAdapters/pusherAdapter.ts in jason-rails-0.8.4 vs client/src/transportAdapters/pusherAdapter.ts in jason-rails-0.8.6
- old
+ new
@@ -4,15 +4,23 @@
import _ from 'lodash'
export default function pusherAdapter(jasonConfig, handlePayload, dispatch) {
const consumerId = uuidv4()
- const { pusherKey, pusherRegion, pusherChannelPrefix } = jasonConfig
- const pusher = new Pusher(pusherKey, {
- cluster: 'eu',
+ const { pusherHost, pusherKey, pusherRegion, pusherChannelPrefix } = jasonConfig
+ let config = {
+ cluster: pusherRegion,
forceTLS: true,
authEndpoint: '/jason/api/pusher/auth'
- })
+ }
+ if (pusherHost) {
+ config = {
+ ...config,
+ wsHost: pusherHost,
+ httpHost: pusherHost,
+ }
+ }
+ const pusher = new Pusher(pusherKey, config)
pusher.connection.bind('state_change', ({ current }) => {
if (current === 'connected') {
dispatch({ type: 'jason/upsert', payload: { connected: true } })
} else {
dispatch({ type: 'jason/upsert', payload: { connected: false } })
\ No newline at end of file