Skip to main content

Mode / Unicast

Launch the server in unicast mode and use q.client to manage client-local state.

from h2o_wave import main, app, Q, ui

async def serve(q: Q):
count = q.client.count or 0

if not q.client.initialized:['example'] = ui.form_card(box='1 1 2 1', items=[
ui.button(name='increment', label=f'Count={count}')
q.client.initialized = True

if q.args.increment:
q.client.count = count = count + 1['example'].items[0].button.label = f'Count={count}'


Tags:  modeunicast