Ravi Patel

Ravi Patel

  • 274
  • 6.8k
  • 1.4m

Is there any android client library available for performing

Sep 23 2016 8:42 AM
SockJs javascript client code is shown below....I am expecting any android library which performs the similar function.... var stompClient = null; function connect(){var socket =newSockJS('/gs-guide-websocket'); stompClient =Stomp.over(socket); stompClient.connect({},function(frame){ setConnected(true); console.log('Connected: '+ frame); stompClient.subscribe('/topic/greetings',function(greeting){ showGreeting(JSON.parse(greeting.body).content);});});}function disconnect(){if(stompClient !=null){ stompClient.disconnect();} setConnected(false); console.log("Disconnected");}function sendName(){ stompClient.send("/app/hello",{}, JSON.stringify({'name': $("#name").val()}));} $(function(){ $("form").on('submit',function(e){ e.preventDefault();}); $("#connect").click(function(){ connect();}); $("#disconnect").click(function(){ disconnect();}); $("#send").click(function(){ sendName();});});Thanks in advance....

Answers (3)