Search in sources :

Example 1 with Transport

use of com.vaadin.flow.shared.ui.Transport in project flow by vaadin.

the class PushView method onAttach.

@Override
protected void onAttach(AttachEvent attachEvent) {
    super.onAttach(attachEvent);
    UI ui = attachEvent.getUI();
    // Fallback transport is forced to websocket so that we either get a
    // websocket connection or no push connection at all
    ui.getPushConfiguration().setFallbackTransport(Transport.WEBSOCKET);
    add(new NativeButton("Say hello", e -> {
        add(new Paragraph("Hello"));
        new Thread(new SayWorld(ui)).start();
    }));
}
Also used : Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton) UI(com.vaadin.flow.component.UI) Transport(com.vaadin.flow.shared.ui.Transport) AttachEvent(com.vaadin.flow.component.AttachEvent) Paragraph(com.vaadin.flow.component.html.Paragraph) Push(com.vaadin.flow.component.page.Push) Route(com.vaadin.flow.router.Route) NativeButton(com.vaadin.flow.component.html.NativeButton) UI(com.vaadin.flow.component.UI) Paragraph(com.vaadin.flow.component.html.Paragraph)

Aggregations

AttachEvent (com.vaadin.flow.component.AttachEvent)1 UI (com.vaadin.flow.component.UI)1 Div (com.vaadin.flow.component.html.Div)1 NativeButton (com.vaadin.flow.component.html.NativeButton)1 Paragraph (com.vaadin.flow.component.html.Paragraph)1 Push (com.vaadin.flow.component.page.Push)1 Route (com.vaadin.flow.router.Route)1 Transport (com.vaadin.flow.shared.ui.Transport)1