Vaadin 14 - VaadinPush.js websocket failure - return code 501

Hi Vaadin team,
I alway receive error message when i load page.

vaadinPush.js?v=2.0.7:1196 WebSocket connection to ‘wss://myapp.io/?v-r=push&v-uiId=1&v-pushId=bdf5fc7c-6e3e-4086-a951-2212485dc510&X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.3.2.vaadin1-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true’ failed: Error during WebSocket handshake: Unexpected response code: 501

see details on attached file.

This may be framework issue ?
Vaadin version 14.0.0.

Regards

17805736.png

Sounds like you are using @Push but the server does not have websockets enabled for one reason or another. Or you have a proxy in between which does not support websockets.

What is your setup?

yes, we use @Push.
our server also has 2 endpoints for websocket (wss). One for device connects to server, one is javascript we load to browser.
and third one is Vaadin push.
only thing is our server only enables to listern wss at port 8443. we are using pivotal web service.
how to config for Vaadin push understand wss port 8443 ?
if we test at localhost, it is fine.

here is our wss you can try:
wss://neonplatform-grumpy-hippopotamus.cfapps.io:8443/services/usersession/8643bd72b7dc46cdaa8359a686a1e4c1

Thanks

i think Vaadin @push should have an option to enable config listen port for ws/wss.

Vaadin uses the server features to add websocket endpoints so any configuration related to that would need to happen in the server. If you have changed the address through a proxy or similar, you can force your Vaadin app to use a given URL for push using getUI().getPushConfiguration().setPushUrl("...") but that will not change the URL that websocket endpoints are deployed to

Arturn,

let say my domain is: neonplatform-grumpy-hippopotamus.cfapps.io
and i only want Vaadin push using wss at port 8443, which param do i need to set to setPushUrl(" ???") ?

is this ?:

setPushUrl(wss://neonplatform-grumpy-hippopotamus.cfapps.io:8443)

i got message below after set @push to use websocket (attched file).

VM1261 vaadinPush.js:2124 Access to XMLHttpRequest at 'wss://neonplatform-grumpy-hippopotamus.cfapps.io:8443/?v-r=push&v-uiId=2&v-pushId=97c22bd8-1c1f-4cda-9325-02fb3817d357&X-Atmosphere-Transport=close&X-Atmosphere-tracking-id=44f45d4a-4b64-4b97-8fdb-e34d69a9ece8&_=1566403796932' from origin 'https://neonplatform-grumpy-hippopotamus.cfapps.io' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
_executeRequest @ VM1261 vaadinPush.js:2124
_pushOnClose @ VM1261 vaadinPush.js:2565
_disconnect @ VM1261 vaadinPush.js:462
_close @ VM1261 vaadinPush.js:491
AtmosphereRequest.close @ VM1261 vaadinPush.js:2922
atmosphere.unsubscribe @ VM1261 vaadinPush.js:2991
(anonymous) @ VM1261 vaadinPush.js:3430
VM1261 vaadinPush.js:2124 GET wss://neonplatform-grumpy-hippopotamus.cfapps.io:8443/?v-r=push&v-uiId=2&v-pushId=97c22bd8-1c1f-4cda-9325-02fb3817d357&X-Atmosphere-Transport=close&X-Atmosphere-tracking-id=44f45d4a-4b64-4b97-8fdb-e34d69a9ece8&_=1566403796932 net::ERR_FAILED

17807238.png

before establishing websocket, vaadinpush.js called XMLHttpRequest.
why vaadinpush.js needs a XMLHttpRequest request if we already set transport for it is websocket ?
in case if vaadinpush.js still needs do a XMLHttpRequest, it should not use entire of the url was set on getPushConfiguration().setPushUrl.

i think this is a problem on vaadinpush.js implementation, that is if we set custom url in getPushConfiguration().setPushUrl(), then all request either https or wss will come to this URL. so if we set:

setPushUrl(wss://neonplatform-grumpy-hippopotamus.cfapps.io:8443)

then https also called to wss://neonplatform-grumpy-hippopotamus.cfapps.io:8443. => this is a bug.

we need to change this implementation.

vaadinpush.js still requests to https://neonplatform-grumpy-hippopotamus.cfapps.io for a XMLHttpRequest.
and only requests to wss://neonplatform-grumpy-hippopotamus.cfapps.io:8443 for websocket.

submitted a request on github:

[https://github.com/vaadin/flow/issues/6320]
(http://)