In CUBA , are all rpc communications between browser and web server made through Long Pull?

Hi,

I have a doubt . I watched the traffics between browser and server through dev tools of browser. Following is the screenshots:

traffics by XHR:


traffics by Websocket:


We can see that two channels both have traffics ,and all traffics through Websocket is server pushed to client,all traffics through Long Pull are RPC requests.
I want to know is it expected behavior? In my mind, all traffics should be made through Websocket if websocket channel is established successfully. Using websocket ,will get more better performance.

There is a topic relate with my doubt : (Server Push via web-socket testing using sampler - CUBA.Platform)

Thanks !

Ray
Regards

Long polling is a fallback mechanism in case client and/or some proxy server does not support WebSocket natively.

Also, CUBA does not use WebSocket for request-response round-trips because AJAX is more reliable in unstable networks, e.g. mobile or Wi-Fi.

Summarizing:

  1. Requests from client are always sent using AJAX
  2. Server initiated events sent either using WebSocket or Long Polling (if web socket connection fails)

P.S. empty rpc array in data means nothing. Check changes key instead.

1 Like

Hi Yuriy,

Thanks for your reply.
Is it possible let CUBA to use Websocket to request server instead of only server to client?

In theory, you could change transport of UI in Vaadin. But bidirectional WebSocket does not support Cookies, so I bet it will break a lot of things in your application.

2 Likes

OK,
Seems implementing this function is a hard work and only CUBA team can achieve .
I will give up trying.
Anyway i get the final answer. Thank you.