add some map basics
This commit is contained in:
12
htdocs/map.html
Normal file
12
htdocs/map.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>OpenWebRX | Open Source SDR Web App for Everyone!</title>
|
||||
<script src="static/jquery-3.2.1.min.js"></script>
|
||||
<script src="static/map.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="static/nanoscroller.css" />
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
30
htdocs/map.js
Normal file
30
htdocs/map.js
Normal file
@ -0,0 +1,30 @@
|
||||
(function(){
|
||||
var protocol = 'ws';
|
||||
if (window.location.toString().startsWith('https://')) {
|
||||
protocol = 'wss';
|
||||
}
|
||||
|
||||
var ws_url = protocol + "://" + (window.location.origin.split("://")[1]) + "/ws/";
|
||||
if (!("WebSocket" in window)) return;
|
||||
|
||||
var ws = new WebSocket(ws_url);
|
||||
ws.onopen = function(){
|
||||
console.info("onopen");
|
||||
ws.send("SERVER DE CLIENT client=map.js type=map");
|
||||
};
|
||||
ws.onmessage = function(){
|
||||
console.info("onmessage");
|
||||
};
|
||||
ws.onclose = function(){
|
||||
console.info("onclose");
|
||||
};
|
||||
|
||||
window.onbeforeunload = function() { //http://stackoverflow.com/questions/4812686/closing-websocket-correctly-html5-javascript
|
||||
ws.onclose = function () {};
|
||||
ws.close();
|
||||
};
|
||||
ws.onerror = function(){
|
||||
console.info("onerror");
|
||||
};
|
||||
|
||||
})();
|
Reference in New Issue
Block a user