def __init__(self, conn, server, request, expiry=None):
        # Initialize session
        super(Session, self).__init__(None, expiry)

        self.server = server
        self.send_queue = []
        self.handler = None

        # Stats
        server.stats.session_opened()

        self.remote_ip = request.remote_ip

        # Create connection instance
        self.conn = conn(self)

        # Call on_open.
        self.info = ConnectionInfo(request.remote_ip,
                              request.arguments,
                              request.cookies)

        # If everything is fine - continue
        self.send_message(proto.connect())

        # Heartbeat related stuff
        self._heartbeat_timer = None
        self._heartbeat_interval = self.server.settings['heartbeat_interval'] * 1000
        self._missed_heartbeats = 0

        # Endpoints
        self.endpoints = dict()

        result = self.conn.on_open(self.info)
        if result is not None and not result:
            raise HTTPError(401)

    # Session callbacks
Session constructor.
dataset/ETHPy150Open mrjoes/tornadio2/tornadio2/session.py/Session.__init__