Refactored Pusher js side to use common factory