Module h2o_wave.server

Functions

listen

def listen(route: str, handle: Callable[[Query], Awaitable[Any]], mode='unicast')

Launch an application server.

Args
route
The route to listen to. e.g. '/foo' or '/foo/bar/baz'.
handle
The handler function.
mode
The server mode. One of 'unicast' (default),'multicast' or 'broadcast'.

Classes

Auth

class Auth(username: str, subject: str)

Represents authentication information for a given query context. Carries valid information only if single sign on is enabled.

Instance variables

var subject

A unique identifier for the user.

var username

The username of the user.

Query

class Query(site: AsyncSite, mode: str, username: str, client_id: str, route: str, app_state: Expando, user_state: Expando, client_state: Expando, auth: Auth, args: Expando)

Represents the query context. The query context is passed to the listen() handler function whenever a query arrives from the browser (page load, user interaction events, etc.). The query context contains useful information about the query, including argumentsargs (equivalent to URL query strings) and app-level, user-level and client-level state.

Instance variables

var app

A Expando instance to hold application-specific state.

var args

A Expando instance containing the active request.

var auth

The username and subject ID of the authenticated user.

var client

An Expando instance to hold client-specific state.

var mode

The server mode. One of 'unicast' (default),'multicast' or 'broadcast'.

var page

A reference to the current page.

var route

The route served by the server.

var site

A reference to the current site.

var user

A Expando instance to hold user-specific state.

var username

The username of the user who initiated the active request.

Methods

sleep

async def sleep(self, delay)

Q

class Q(site: AsyncSite, mode: str, username: str, client_id: str, route: str, app_state: Expando, user_state: Expando, client_state: Expando, auth: Auth, args: Expando)

Represents the query context. The query context is passed to the listen() handler function whenever a query arrives from the browser (page load, user interaction events, etc.). The query context contains useful information about the query, including argumentsargs (equivalent to URL query strings) and app-level, user-level and client-level state.

Instance variables

var app

A Expando instance to hold application-specific state.

var args

A Expando instance containing the active request.

var auth

The username and subject ID of the authenticated user.

var client

An Expando instance to hold client-specific state.

var mode

The server mode. One of 'unicast' (default),'multicast' or 'broadcast'.

var page

A reference to the current page.

var route

The route served by the server.

var site

A reference to the current site.

var user

A Expando instance to hold user-specific state.

var username

The username of the user who initiated the active request.

Methods

sleep

async def sleep(self, delay)