class SubscribePusher { constructor(subscribe, event, apikey) { this.subscribe = subscribe; this.event = event; this.apikey = apikey; this.pusher = new Pusher(this.apikey, { cluster: 'ap1', // Replace 'your_cluster' with the actual cluster of your Pusher app }); } channel_subscribe(callback) { let channel = this.pusher.subscribe(this.subscribe); channel.bind(this.event, function(data){ callback(data); }); } } export default SubscribePusher;