blob: 48d27216bedf9aa1daf4d2a4e96f860e9315a0c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<!DOCTYPE html>
<meta charset="utf-8">
<title>WebSocket Opener</title>
<script>
window.addEventListener("message", function (event) {
const socket = new WebSocket(event.data);
socket.onopen = () => {
parent.postMessage("open", "*");
};
socket.onclose = (evt) => {
parent.postMessage(`close: code ${evt.code}`, "*");
};
});
</script>
|