diff options
Diffstat (limited to 'backend/src/main/resources/static')
-rw-r--r-- | backend/src/main/resources/static/test-ws.js | 40 | ||||
-rw-r--r-- | backend/src/main/resources/static/test.html | 55 |
2 files changed, 0 insertions, 95 deletions
diff --git a/backend/src/main/resources/static/test-ws.js b/backend/src/main/resources/static/test-ws.js deleted file mode 100644 index 1c64349e..00000000 --- a/backend/src/main/resources/static/test-ws.js +++ /dev/null @@ -1,40 +0,0 @@ -var stompClient = null; - -function connect() { - console.log('Connecting...'); - var socket = new SockJS('/seven-wonders-websocket'); - stompClient = Stomp.over(socket); - stompClient.connect({}, function (frame) { - console.log('Connected: ' + frame); - subscribeTo('/user/queue/errors'); - }); -} - -function send(endpoint, payload) { - stompClient.send(endpoint, {}, payload); -} - -function subscribeTo(endpoint) { - $("#test-feeds").prepend('<tr><td>' + endpoint + '</td><td>Subscribed</td></tr>'); - stompClient.subscribe(endpoint, function (data) { - $("#test-feeds").prepend('<tr><td>' + endpoint + '</td><td>Received: <pre>' + data.body + '</pre></td></tr>'); - }); -} - -$(function () { - $("form").on('submit', function (e) { - e.preventDefault(); - }); - $("#send-btn").click(function () { - var endpoint = $("#path-field").val(); - var payload = $("#payload-field").val(); - send(endpoint, payload); - }); - $("#subscribe-btn").click(function () { - var endpoint = $("#subscribe-path-field").val(); - subscribeTo(endpoint); - }); -}); - -// auto-connect -connect();
\ No newline at end of file diff --git a/backend/src/main/resources/static/test.html b/backend/src/main/resources/static/test.html deleted file mode 100644 index e19f9eb3..00000000 --- a/backend/src/main/resources/static/test.html +++ /dev/null @@ -1,55 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <title>Seven Wonders</title> - <link href="/webjars/bootstrap/css/bootstrap.min.css" rel="stylesheet"> - <link href="/main.css" rel="stylesheet"> - <script src="/webjars/jquery/jquery.min.js"></script> - <script src="/webjars/sockjs-client/sockjs.min.js"></script> - <script src="/webjars/stomp-websocket/stomp.min.js"></script> - <script src="test-ws.js"></script> -</head> -<body> -<noscript> - <h2 style="color: #ff0000">Seems your browser doesn't support Javascript! Websocket relies on Javascript being - enabled. Please enable Javascript and reload this page!</h2> -</noscript> - -<h1>Seven Wonders Test Page</h1> - -<h2>WS messages tests</h2> - -<form class="form-inline"> - <div class="form-group"> - <label for="subscribe-path-field">Path:</label> - <input id="subscribe-path-field" placeholder="path"> - <button id="subscribe-btn" class="btn btn-default" type="submit">Subscribe</button> - </div> -</form> - -<form class="form-inline"> - <div class="form-group"> - <label for="path-field">Path:</label> - <input id="path-field" placeholder="path"> - <label for="payload-field">Payload:</label> - <input id="payload-field" placeholder="JSON payload"> - <button id="send-btn" class="btn btn-default" type="submit">Send</button> - </div> -</form> - -<h2>Subscribed feeds</h2> - -<table class="table table-striped"> - <thead> - <tr> - <th>Endpoint</th> - <th>Data received</th> - </tr> - </thead> - <tbody id="test-feeds"> - </tbody> -</table> - - -</body> -</html>
\ No newline at end of file |