         dispatch_barrier_async(self._concurrentSubscriptionQueue, { () -> Void in
             // needs to be running in order to get server url for the subscription message
             let httpServer = self._httpServer
-            if !httpServer.running {
-                httpServer.startWithPort(self._httpServerPort, bonjourName: nil)
-            }
-            
-            let serverURL = httpServer.serverURL
-            
-            // Stop http server if it's not needed further
-            self.startStopHTTPServerIfNeeded(self._subscriptions)
+            var serverURL: NSURL? = httpServer.serverURL
+            
+            // most likely nil if the http server is stopped
+            if serverURL == nil && !httpServer.running {
+                // Start http server
+                if self.startHTTPServer() {
+                    // Grab server url
+                    serverURL = httpServer.serverURL
+                    
+                    // Stop http server if it's not needed further
+                    self.startStopHTTPServerIfNeeded(self._subscriptions)
+                }
+                else {
+                    LogError("Error starting HTTP server")
+                }
+            }
             
             dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), { () -> Void in
                 serverURL != nil ? closure(eventCallBackURL: NSURL(string: self._eventCallBackPath, relativeToURL: serverURL)!) : closure(eventCallBackURL: nil)

        return dataTask
    }
}

                LogError("\(errorDescription)")
            }
        })
    }
    
    private func startHTTPServer() -> Bool {
        if _httpServer.safeToStart {
            return _httpServer.startWithPort(_httpServerPort, bonjourName: nil)
        }
        
        return false
    }
    
    private func stopHTTPServer() -> Bool {
        if _httpServer.safeToStop {
            _httpServer.stop()
            return true
        }
        
        return false
    }
}

