mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-23 11:44:53 +00:00
ws_ssl -> websocket_ssl_proxy
This commit is contained in:
1 parent
6083b9c5c5
commit
2987cbdb5c
13 files changed
+4
-4
No files matched your search
@@ -0,0 +1,50 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Websocket Proxy SSL Test</title>
|
||||
<meta charset="utf-8">
|
||||
<script>
|
||||
window.onload = function() {
|
||||
var protocols = ['ws://', 'wss://'];
|
||||
var websocketServers = ['ws1', 'ws2'];
|
||||
//protocols = ['wss://'];
|
||||
//websocketServers = ['ws1']
|
||||
|
||||
var createWebsocketConnection = function(proto, server) {
|
||||
var conn = new WebSocket(proto + server);
|
||||
|
||||
var div = document.createElement('div');
|
||||
var h2 = document.createElement('h2');
|
||||
h2.innerHTML = 'Connection to ' + proto + server;
|
||||
document.body.appendChild(h2);
|
||||
document.body.appendChild(div);
|
||||
|
||||
conn.onmessage = function(ev) {
|
||||
var el = document.createElement('div');
|
||||
el.innerHTML = 'websocket message: ' + ev.data;
|
||||
div.appendChild(el);
|
||||
// Keep only last 5 messages in the list
|
||||
while (div.childNodes.length > 5) div.removeChild(div.firstChild);
|
||||
};
|
||||
|
||||
// Send some string to the websocket connection periodically.
|
||||
// websocket server much echo it back.
|
||||
window.setInterval(function() { conn.send(Math.random()); }, 1000);
|
||||
};
|
||||
|
||||
for (var i = 0; i < protocols.length; i++) {
|
||||
for (var j = 0; j < websocketServers.length; j++) {
|
||||
createWebsocketConnection(protocols[i], websocketServers[j]);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
body > div {
|
||||
border: 1px solid #ccc; background: #f0f0f0; padding: 0 1em;
|
||||
margin: 0 2em; min-height: 4em; max-width: 40em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user