12345678910111213141516171819202122232425 |
- var stompClient = null;
- function connect() {
- var socket = new SockJS('http://localhost:8081/amp/websocket');
- stompClient = Stomp.over(socket);
- stompClient.connect({}, function (frame) {
- console.log('Connected: ' + frame);
- stompClient.subscribe('/channel/entity-events', function (msg) {
- var msgJ = JSON.parse(msg.body);
- console.log(msgJ);
- });
- });
- }
- function disconnect() {
- if (stompClient !== null) {
- stompClient.disconnect();
- }
- setConnected(false);
- console.log("Disconnected");
- }
- $(document).ready(function() {
- connect();
- });
|