mirror of
https://github.com/safing/portbase
synced 2026-04-28 20:00:33 +00:00
Finish first API version
This commit is contained in:
parent
d7e0602548
commit
31c09512a0
6 changed files with 175 additions and 22 deletions
49
api/testclient/root/index.html
Normal file
49
api/testclient/root/index.html
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<!-- <script src="https://cdn.jsdelivr.net/sockjs/1/sockjs.min.js"></script> -->
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
|
||||
var ws = new WebSocket('ws://127.0.0.1:18/api/database/v1')
|
||||
|
||||
ws.onopen = function () {
|
||||
console.log('open');
|
||||
};
|
||||
|
||||
ws.onerror = function (error) {
|
||||
console.log('error');
|
||||
console.log(error);
|
||||
};
|
||||
|
||||
ws.onmessage = function (e) {
|
||||
reader = new FileReader()
|
||||
reader.onload = function(e) {
|
||||
console.log(e.target.result)
|
||||
}
|
||||
reader.readAsText(e.data)
|
||||
};
|
||||
|
||||
function send(text) {
|
||||
ws.send(text)
|
||||
}
|
||||
|
||||
// var sock = new SockJS("http://localhost:8080/api/v1");
|
||||
//
|
||||
// sock.onopen = function() {
|
||||
// console.log('open');
|
||||
// };
|
||||
//
|
||||
// sock.onmessage = function(e) {
|
||||
// console.log('message received: ', e.data);
|
||||
// };
|
||||
//
|
||||
// sock.onclose = function(e) {
|
||||
// console.log('close', e);
|
||||
// };
|
||||
</script>
|
||||
yeeee
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue