'Close the connection.
This includes telling the other side we\'re closing the connection.
If the other side didn\'t signal that the connection is being closed,
then we might not see their last message, but since their last message
should, according to the spec, be a simple acknowledgement, it
shouldn\'t be a problem.'

def close(self, reason=''):

    if (self.flavor in (HYBI07, HYBI10, RFC6455)):
        frame = make_hybi07_frame(reason, opcode=8)
        self.transport.write(frame)
    self.loseConnection()
