title: How can I deal with an "Failed to construct WebSocket: The URL is invalid" JavaScript exception?
body: <p>I am trying to configure my Vaadin Application (version 7.7.15) to support IPv6 and somehow the URL is encoded incorrectly.</p>
  
  <p>For example: If the ip is: fd71:2d5a:e15a:1ed3::1, on browser you access it like this: <a href="http://[fd71:2d5a:e15a:1ed3::1]" rel="nofollow noreferrer">http://[fd71:2d5a:e15a:1ed3::1]</a>.</p>
  
  <p>The problem is that the character '[' is replaced with '%5B' and the character ']' is replaced with '%5D'.</p>
  
  <p>This encoding cause a "Failed to construct WebSocket: The URL is invalid; JavaScriptException [SyntaxError]" as the picture is describing.</p>
  
  <p>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.</p>
  
  <p>Can anyone tell me please how can I escape those characters from been encoded?</p>
  
  <p>Thank you,
  George</p>
  
  <p><img src="https://i.stack.imgur.com/gZp73.png" alt="WebSocket Error"></p>