OWL ITS + 탐지시스템(인터넷 진흥원)
jhjang
2021-10-14 722a8a9409f3bbe3da0a1c77d709d68cfb0a6705
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$(document).ready(function(){
 
  var url = "ws://localhost:61623";
  var login = "admin";
  var passcode = "password"
  var destination = "/topic/chat.general";
  
  $("#server_url").text(url);
  $("#queue_name").text(destination);
  
  var client = Stomp.client(url);
 
  debug = function(str) {
    $("#debug").append(str + "\n");
  };
  client.debug = debug;
  // the client is notified when it is connected to the server.
  var onconnect = function(frame) {
      debug("connected to Stomp");
      client.subscribe(destination,
        function(frame) {
          client.unsubscribe(destination);
          client.disconnect();
        },
        { receipt: 1234 });
  };
  client.onerror = function(frame) {
      debug("connected to Stomp");
  };
  client.ondisconnect = function() {
    debug("disconnected from Stomp");
  };
  client.onreceipt = function() {
    debug("receipt from Stomp");
    client.send(destination, {foo: 1}, "test")
  };
 
  client.connect(login, passcode, onconnect);
 
  return false;
});