     @eventCache = {}
     @initLocalStorage()
 
-    { pubnub } = globals.config
-
-    if pubnub.enabled and pubnub.subscribekey
+    if @isPubNubEnabled()
       @initPubNub()
     else
       @initNodeNotification()


  initNodeNotification: ->

    (new NodeNotificationClient).connect()

  subscribeNotification: (callback) ->

    { nickname } = whoami().profile

    if @isPubNubEnabled()

      { environment } = globals.config
      channelName = "notification-#{environment}-#{nickname}"
      options = { channelName }
      options.authenticate =
        endPoint : '/api/gatekeeper/subscribe/notification'
        data     : { id: whoami().socialApiId }

      options.pbInstance = @pbNotification

      @subscribePubNub options, callback

    else

      callback null, @nodeNotificationClient



  subscribePubNub: (options = {}, callback) ->
