     /// Topic prefix for all subscribed topics
     private let notificationPrefix = "/earlydata/pushy"
     
-    private let pushSvc:MqttClient
+    //private let pushSvc:MqttClient
+    
     
     private func notificationTopic(clientId:String)->String{
         return "\(self.notificationPrefix)\(clientId)/notify/#"
     }
-    
-    public init(config conf:PushyConf) throws {
-        self.conf = conf
+    public func registerPushNotifications() {
+        DispatchQueue.main.async {
+            let settings = UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil)
+            UIApplication.shared.registerUserNotificationSettings(settings)
+        }
+    }
+    
+    
+    public init(/*config conf:PushyConf*/) throws {
+        //self.conf = conf
+        if let path = Bundle.main.path(forResource: "Pushy", ofType: "plist"),
+        let dict = NSDictionary(contentsOfFile: path) as? [String: AnyObject] {
+            // use swift dictionary as normal
+            let appId = dict["appKey"] as! String
+            let appSecret = dict["appSecret"] as! String
+            let regUrl = dict["registrationUrl"] as! String
+            
+            self.conf = PushyConf(host: regUrl, port: 1883, registrationUrl: regUrl, deviceId: "", clientId: "",langType:1,user: appId, password: appSecret)
+        }else{
+            throw PushyError.mqttConfigError(reason: "Pushy.plist incorrectly defined.")
+        }
+
+        
         do{
             try networkMonitor.startNotifier()
         }catch{
             Logger.log("Unable to start network notifier")
         }
         
-        pushSvc = MqttClient(config: conf,networkMonitor:networkMonitor)
-        unowned let that = self
-        pushSvc.messageCallback = that.handleMessage
-        pushSvc.subscribe(topic: notificationTopic(clientId: conf.clientId))
-        
-        try doUpdateDeviceId(deviceId: conf.deviceId, clientId: conf.clientId, host: conf.host)
-        
-        pushSvc.connect()
+//        pushSvc = MqttClient(config: conf,networkMonitor:networkMonitor)
+//        unowned let that = self
+//        pushSvc.messageCallback = that.handleMessage
+//        pushSvc.subscribe(topic: notificationTopic(clientId: conf.clientId))
+        
+//        try doUpdateDeviceId(deviceId: conf.deviceId, clientId: conf.clientId, host: conf.host)
+        
+//        pushSvc.connect()
         
     }
     
     public func updateClientDevice(deviceId:String, clientId:String){
         try? self.doUpdateDeviceId(deviceId: deviceId, clientId: clientId, host: conf.host)
     }
-    
+    /*
     public func subscribe(topic: String){
         pushSvc.subscribe(topic: topic)
     }

    public func unsubscribe(clientId: String){
        pushSvc.unsubscribe(topic: notificationTopic(clientId: clientId))
    }
    
    @objc private func fireUpdateWhenNotified(notification:NSNotification){
        
        if let payload = notification.object as? (deviceId:String,clientId:String,host:String){

import CocoaMQTT
import SystemConfiguration
import CoreData
import UIKit


/*
