Solved

Understanding websocket example in spring

Posted on 2016-09-27
1
118 Views
Last Modified: 2016-10-14
HI,
I am using hte websocket example on : https://spring.io/guides/gs/messaging-stomp-websocket/
when i click on the connect button on the web page which loads when this application code is run the following code executes :
function connect() {
    var socket = new SockJS('/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);
        });
    });
}

Open in new window


And i see the following two network calls in the Network tab of chrome :
http://localhost:8080/gs-guide-websocket/info?t=1474970676486
ws://localhost:8080/gs-guide-websocket/614/vbxj5iok/websocket

What do these mean and what are there purpose... what are the things in bold means and where did they come from ?


Thanks
0
Comment
Question by:Rohit Bajaj
1 Comment
 
LVL 35

Accepted Solution

by:
Kimputer earned 500 total points
ID: 41817699
When using a framework, api or other services that are meant to make things easy, you usually don't look under the hood too much. It's why you are using it in the first place, to make things easy for you.
In this case, you should check the request and the response (input name, get "hello name" back), if that's expected or not. Not really dig so deep as to what it's really sending in and out. The requests are all taken care of the backbone (in your case Spring.io), and the programmers could tell you the specifics but it would probably take quite some time for you to understand.
Usually it's a combination of time, randomness, and things to track.
0

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question