We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ea5f28 commit 6d386e7Copy full SHA for 6d386e7
www/wstest.html
@@ -20,12 +20,20 @@
20
21
function testWebSocket()
22
{
23
- var scheme
+ var scheme, defaultPort
24
if (window.location.protocol == 'https:')
25
+ {
26
scheme = 'wss:';
27
+ defaultPort = 443;
28
+ }
29
else
30
31
scheme = 'ws:';
32
+ defaultPort = 80;
33
34
var wsUri = scheme + '//' + window.location.hostname;
35
+ if (window.location.port !== defaultPort)
36
+ wsUri += ':' + window.location.port;
37
writeToScreen("Connecting to " + wsUri + "...")
38
websocket = new WebSocket(wsUri);
39
websocket.onopen = function(evt) { onOpen (evt) };
@@ -81,4 +89,4 @@ <h1>MicroWebSrv2 - WebSockets Module</h1>
81
89
<div id="output"></div>
82
90
</body>
83
91
84
-</html>
92
+</html>
0 commit comments