george petre
george petre

Reputation: 21

How can I deal with an "Failed to construct WebSocket: The URL is invalid" JavaScript exception?

I am trying to configure my Vaadin Application (version 7.7.15) to support IPv6 and somehow the URL is encoded incorrectly.

For example: If the ip is: fd71:2d5a:e15a:1ed3::1, on browser you access it like this: http://[fd71:2d5a:e15a:1ed3::1].

The problem is that the character '[' is replaced with '%5B' and the character ']' is replaced with '%5D'.

This encoding cause a "Failed to construct WebSocket: The URL is invalid; JavaScriptException [SyntaxError]" as the picture is describing.

But if I modify the @Push annotation from @Push(transport = Transport.WEBSOCKET_XHR) to @Push(transport = Transport.LONG_POLLING), I am able to access the UI, but the API Calls are very very slow.

Can anyone tell me please how can I escape those characters from been encoded?

Thank you, George

WebSocket Error

Upvotes: 1

Views: 1040

Answers (1)

george petre
george petre

Reputation: 21

Updates:

This bug was resolved into the Atmosphere Framework as you can see in the pull request linked below: https://github.com/Atmosphere/atmosphere-javascript/pull/243

Regards, George

Upvotes: 0

Related Questions