# File lib/skinny.rb, line 384
    def finish!
      if hixie_75? or hixie_76?
        send_data "\xff\x00"
      else
        send_frame OPCODE_CLOSE
      end

      EM.next_tick { callback(:on_finish, self) rescue error! "Error in finish callback" }
      EM.next_tick { close_connection_after_writing }

      @state = :finished
    rescue
      error! "Error finishing WebSocket connection"
    end