Websocket instead of AJAX to communicate between Vaadin JS client and serve

Is it possible to configure Vaadin, that vaadin JS client send all the requests over Websocket instead of AJAX ? It will reduce traffic from client to server radically.

You can set up Push, which will communicate some changes (server to client traffic outside of the normal request scope) with WebSockets, but even then, you will still use normal HTTP requests most of the time. There’s no out of the box way of replacing all communication with WebSockets, and I’d imagine implementing that would be quite difficult.

-Olli

Olli Tietäväinen:
You can set up Push, which will communicate some changes (server to client traffic outside of the normal request scope) with WebSockets, but even then, you will still use normal HTTP requests most of the time. There’s no out of the box way of replacing all communication with WebSockets, and I’d imagine implementing that would be quite difficult.

-Olli

Hi, I have read the article [The 3 different transport-modes with vaadin and push]
(https://blog.codecentric.de/en/2014/08/the-3-different-transport-modes-with-vaadin-and-push/)
The author writes: "The Transports are not only used for server-push. If you activate push, the normal user-interactions are also handled with these transports."
and
"From now on, we have a connection which will be used for all transports (client -> server and server -> client)."
Does it mean, that client -> server traffic will go over WebSocket instead of http requests as well ?

And one more question: If I modify UI data from UI events handler (i.e. not from bacakground thread), should I still leverage access ?

Vitalii Lipovetskii:

Olli Tietäväinen:
You can set up Push, which will communicate some changes (server to client traffic outside of the normal request scope) with WebSockets, but even then, you will still use normal HTTP requests most of the time. There’s no out of the box way of replacing all communication with WebSockets, and I’d imagine implementing that would be quite difficult.

-Olli

Does it mean, that client -> server traffic will go over WebSocket instead of http requests as well ?

No, that still uses HTTP. You can use e.g. Chrome’s developer tools to see the network traffic and it will give you an idea of what’s going on.

And one more question: If I modify UI data from UI events handler (i.e. not from bacakground thread), should I still leverage access ?

If you’re not in a background thread, then all changes will be sent in a bundle via HTTP when the servlet responds normally.