code: def listen_on_socket(self, socket_name=None):
          
          def connection_cb(pipe_connection):
              # We have to create a new `context`, because this will be the scope for
              # a new prompt_toolkit.Application to become active.
              with context():
                  connection = ServerConnection(self, pipe_connection)
  
              self.connections.append(connection)
  
          self.socket_name = bind_and_listen_on_socket(socket_name, connection_cb)
  
          # Set session_name according to socket name.
  #        if '.' in self.socket_name:
  #            self.session_name = self.socket_name.rpartition('.')[-1]
  
          logger.info('Listening on %r.' % self.socket_name)
          return self.socket_name
docs: Listen for clients on a Unix socket.
          Returns the socket name.