Skip to content

FletApp

Inherits: Connection

Handle Flet app WebSocket connections.

Parameters:

  • loop (AbstractEventLoop) –

    asyncio event loop (asyncio.get_running_loop()).

  • executor (ThreadPoolExecutor) –

    Thread pool executor (app_manager.executor).

  • main

    Application entry point - an async method called for newly connected user. Handler coroutine must have 1 parameter of instance Page.

  • before_main

    Called before main.

  • session_timeout_seconds (int, default: DEFAULT_FLET_SESSION_TIMEOUT ) –

    Session lifetime, in seconds, after user disconnected.

  • oauth_state_timeout_seconds (int, default: DEFAULT_FLET_OAUTH_STATE_TIMEOUT ) –

    OAuth state lifetime, in seconds, which is a maximum allowed time between starting OAuth flow and redirecting to OAuth callback URL.

  • upload_endpoint_path (str | None, default: None ) –

    Absolute URL of upload endpoint, e.g. /upload.

  • secret_key (str | None, default: None ) –

    Secret key to sign upload requests.

Properties

Methods

Properties#

executor instance-attribute #

executor = executor

loop instance-attribute #

loop = loop

Methods#

dispose #

dispose()

get_upload_url #

get_upload_url(file_name: str, expires: int) -> str

handle async #

handle(websocket: WebSocket)

Handle WebSocket connection.

Parameters:

  • websocket (WebSocket) –

    WebSocket instance.

oauth_authorize #

oauth_authorize(attrs: dict[str, Any])

send_message #

send_message(message: ClientMessage)