     # Subscribe to events from the socket
     @subscribeSocket socket, from
 
-    @connectPort socket, to, edge.to.port, edge.to.index, true
-    @connectPort socket, from, edge.from.port, edge.from.index, false
-
-    @connections.push socket
-    callback()
+    @connectPort socket, to, edge.to.port, edge.to.index, true, (err) =>
+      return callback err if err
+      @connectPort socket, from, edge.from.port, edge.from.index, false, (err) =>
+        return callback err if err
+
+        @connections.push socket
+        callback()
 
   removeEdge: (edge, callback) ->
     for connection in @connections

      do callback

  addDefaults: (node, callback) ->

    process = @processes[node.id]

    unless process.component.isReady()

        # Subscribe to events from the socket
        @subscribeSocket socket

        @connectPort socket, process, key, undefined, true, ->

        @connections.push socket

