Index: net/data/websocket/count-connection.html |
diff --git a/net/data/websocket/connect_check.html b/net/data/websocket/count-connection.html |
similarity index 54% |
copy from net/data/websocket/connect_check.html |
copy to net/data/websocket/count-connection.html |
index 4a1ca8c5dfc0b7cb86b86f019a3a4038db867f35..abdab0e4e327d345312c1bcc6cea27cddd5af1f6 100644 |
--- a/net/data/websocket/connect_check.html |
+++ b/net/data/websocket/count-connection.html |
@@ -1,9 +1,10 @@ |
-<!DOCTYPE html> |
+<!doctype html> |
<html> |
<head> |
-<title>test ws connection</title> |
+<title>Connect to a WebSocket server</title> |
<script type="text/javascript"> |
+ |
var href = window.location.href; |
var hostBegin = href.indexOf('/') + 2; |
var hostEnd = href.lastIndexOf(':'); |
@@ -12,23 +13,18 @@ var portBegin = hostEnd + 1; |
var portEnd = href.lastIndexOf('/'); |
var port = href.slice(portBegin, portEnd); |
var scheme = href.indexOf('https') >= 0 ? 'wss' : 'ws'; |
-var url = scheme + '://' + host + ':' + port + '/echo-with-no-extension'; |
+var url = scheme + '://' + host + ':' + port + '/count-connection'; |
// Do connection test. |
var ws = new WebSocket(url); |
-ws.onopen = function() |
-{ |
- // Set document title to 'PASS'. The test observer catches this title changes |
- // to know the result. |
- document.title = 'PASS'; |
+ws.onmessage = function(e) { |
+ document.title = (e.data === 'open: 1, closed: 1' ? 'PASS' : 'FAIL'); |
} |
-ws.onclose = function() |
-{ |
- // Set document title to 'FAIL'. |
- document.title = 'FAIL'; |
-} |
+ws.onclose = function() { |
+ document.title = 'FAIL'; |
+}; |
</script> |
</head> |