def __init__(self, loop, url, api_key=None, **kwargs):
        loop = loop

        try:
            self.heartbeat_timeout = kwargs.pop('heartbeat')
        except __HOLE__:
            self.heartbeat_timeout = 15.0

        self.api_key = api_key

        # define status
        self.active = False
        self.closed = False

        # dict to maintain opened channels
        self.channels = dict()

        # dict to maintain commands
        self.commands = dict()

        # emitter for global events
        self._emitter = EventEmitter(loop)
        self._heartbeat = pyuv.Timer(loop)
        super(GafferSocket, self).__init__(loop, url, **kwargs)

        # make sure we authenticate first
        if self.api_key is not None:
            self.write_message("AUTH:%s" % self.api_key)
dataset/ETHPy150Open benoitc/gaffer/gaffer/httpclient/websocket.py/GafferSocket.__init__