app

trame.app.get_server(name=None, create_if_missing=True, client_type=None, **kwargs)

Return a server for serving trame applications. If a name is given and such server is not available yet, it will be created otherwise the previously created instance will be returned.

Parameters:
  • name (None | str | Server instance) – A server name identifier which can be useful when several servers are expected to be created. Most of the time, passing no arguments is what you are looking for. Also an actual Server instance can be provided so you can use it as a decorator function.

  • create_if_missing (bool) – By default if a server for a given name does not exist that method will create it.

  • client_type (None | "vue2" | "vue3") – If provided, it will set it on the server.

  • **kwargs

    any extra keyword args are passed as option to the server instance.

Returns:

Return a unique Server instance per given name.

Return type:

trame_server.core.Server

trame.app.get_client(url=None, hot_reload=False, **kwargs)

Return a client to a remote trame applications. If a url is given and such client is not available yet, it will be created otherwise the previously created instance will be returned.

Parameters:
  • url (str) – Websocket URL which to connect to.

  • hot_reload (bool) – Enable when state change function should be hot reloaded.

  • **kwargs

    any extra keyword args use for authentication configuration.

Returns:

Return a unique Client instance per given url. Each instance need to a connect() call.

Return type:

trame_server.client.Client