     process: (event, payload) ->
       return unless event is 'data'
       unsubscribe c.runtime, c.outPorts.out if c.runtime
-      unless payload.canDo 'protocol:component'
+      if payload.isConnected() and not payload.canDo 'protocol:component'
         return c.error new Error "Runtime #{payload.definition.id} is not able to list components"
       c.runtime = payload
       subscribe c.runtime, c.outPorts.out

onRuntimeComponent = null

subscribe = (runtime, port) ->
  onRuntimeConnected = ->
    runtime.sendComponent 'list'
    port.connect()
  onRuntimeComponent = (message) ->
    return unless message.command is 'component'
    return if message.payload.name in ['Graph', 'ReadDocument']

    port.send
      componentDefinition: definition

  runtime.on 'capabilities', onRuntimeConnected
  runtime.on 'component', onRuntimeComponent
  do requestListing if runtime.isConnected()

unsubscribe = (runtime, port) ->
  port.disconnect()
