 #
 # Input Port (inport) implementation for NoFlo components. These
 # ports are the way a component receives Information Packets.
-class InPort extends BasePort
+module.exports = class InPort extends BasePort
   constructor: (options = {}) ->
     options.control ?= false
     options.scoped ?= true

      @handleSocketEvent 'disconnect', socket, localId
    socket.on 'ip', (ip) =>
      @handleIP ip, localId

  handleIP: (ip, id) ->
    return if @options.control and ip.type isnt 'data'

    buf.shift() if @options.control and buf.length > 1

    @emit 'ip', ip, id
    return

  handleSocketEvent: (event, payload, id) ->
    # Emit port event
    if @isAddressable()
      return @emit event, payload, id
    return @emit event, payload

  hasDefault: ->
    return @options.default isnt undefined
