       @brackets.push ip.data
 
     if ip.type is 'closeBracket'
-      unless @brackets.length
-        # Last bracket was closed, we're disconnected
-        # If we were already disconnected, no need to disconnect again
-        return if @brackets.length is 0
+      # Last bracket was closed, we're disconnected
+      # If we were already disconnected, no need to disconnect again
+      return if @brackets.length is 0
       # Add group name to bracket
       ip.data = @brackets.pop()
 


    # Emit the legacy event
    legacyEvent = @ipToLegacy ip
    @emitEvent 'connect', @ if ip.type is 'data' and @brackets.length is 0 and autoConnect
    @emitEvent legacyEvent.event, legacyEvent.payload
    @emitEvent 'disconnect', @ if ip.type is 'data' and @brackets.length is 0 and autoConnect

exports.InternalSocket = InternalSocket


  # sending semantics single IP objects can be sent without open/close brackets.
  post: (data) ->
    data = @dataDelegate() if data is undefined and typeof @dataDelegate is 'function'
    @emitEvent 'connect', @ if data.type is 'data' and @brackets.length is 0
    @handleSocketEvent 'data', data, false
    @emitEvent 'disconnect', @ if data.type is 'data' and @brackets.length is 0

  # ## Information Packet grouping
  #
