How to use WebSockets as event transport.

Can I use WebSockets not only for server → client conversetions?
I have button in my UI and click listener attached to it. When i click on the button new http request will be sent. I want to use WebSocket fot this purpose instead http requests.

Hi Victor,

did you use the @Push annotation in your UI to set up Vaadin Push (using websockets)?
Did you check that both your browser and server support Web Sockets natively?

https://github.com/vaadin/vaadin/blob/master/server/src/main/java/com/vaadin/server/communication/PushConnection.java
mentions the Web Sockets are being used in a bidirectional fashion - however I have not analysed in which way this is taken advantage of.

Also, in HTTP/1.1 usually re-uses open TCP connections, so there shouldn’t be any overhead anyway.

Would you elaborate more on your plans and/or share your code?

Best,
–Enver

Best,
–Enver