OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>slave tab pages which create hanging wss connection</title> | 4 <title>slave tab pages which create hanging wss connection</title> |
5 <script type="text/javascript"> | 5 <script type="text/javascript"> |
6 var href = window.location.href; | 6 var href = window.location.href; |
| 7 var hostBegin = href.indexOf('/') + 2; |
| 8 var hostEnd = href.lastIndexOf(':'); |
| 9 var host = href.slice(hostBegin, hostEnd); |
7 var queryBegin = href.lastIndexOf('?') + 1; | 10 var queryBegin = href.lastIndexOf('?') + 1; |
8 var port = href.slice(queryBegin); | 11 var port = href.slice(queryBegin); |
9 var url = 'wss://localhost:' + port; | 12 var url = 'wss://' + host + ':' + port; |
10 var ws; | 13 var ws; |
11 var cb = function() { | 14 var cb = function() { |
12 ws = new WebSocket(url); | 15 ws = new WebSocket(url); |
13 ws.onclose = cb; | 16 ws.onclose = cb; |
14 } | 17 } |
15 cb(); | 18 cb(); |
16 </script> | 19 </script> |
17 </head> | 20 </head> |
18 </html> | 21 </html> |
OLD | NEW |