var client;
var subscription;
- vm.url = $location.protocol() + '://' + $location.host() + '/spring-stomp-server-full/fullportfolio';
+ vm.endpointSimple = $location.protocol() + '://' + $location.host() + '/spring-stomp-server-simple/portfolio';
+ vm.endpointFull = $location.protocol() + '://' + $location.host() + '/spring-stomp-server-full/fullportfolio';
+ vm.url = vm.endpointSimple;
vm.clientDestination = '/topic/greeting';
vm.serverDestination = '/app/greeting';
vm.connectHeaders = JSON.stringify({
vm.connect = function () {
+ vm.debugLog = '';
// use SockJS implementation instead of the browser's native implementation
var options = {
debug: true,
var ws = new SockJS(vm.url, undefined, options);
client = Stomp.over(ws);
client.heartbeat.outgoing = 20000; // client will send heartbeats every 20000ms
- client.heartbeat.incoming = 0; // client does not want to receive heartbeats from the server
+ client.heartbeat.incoming = 20000; // server will send heartbeats every 20000ms
+ client.debug = stompClientDebug;
client.connect(JSON.parse(vm.connectHeaders), connectCallback, errorCallback);
};
function errorCallback(error) {
// display the error's message header:
- alert(error.headers.message);
+ if (error.headers) {
+ alert(error.headers.message);
+ } else {
+ alert(error);
+ }
}
function subscribeCallback(message) {
function disconnectCallback() {
alert('See you next time!');
}
+
+ function stompClientDebug(string) {
+ vm.debugLog = vm.debugLog + string + '\n';
+ }
}
})();
<label>
Endpoint:<br>
- <input value="http://localhost:8080" ng-model="vm.url" placeholder="url">
+ <textarea style="width: 200%; border: none">{{vm.endpointSimple}}</textarea><br>
+ <textarea style="width: 200%; border: none">{{vm.endpointFull}}</textarea><br>
+ <input value="http://localhost:8080" ng-model="vm.url" placeholder="url"/>
</label>
<br>
<label>
<label>
Queue:<br>
- <input value="/rpc/" ng-model="vm.clientDestination" placeholder="Client-Destination">
+ <input value="/rpc/" ng-model="vm.clientDestination" placeholder="Client-Destination"/>
</label>
<br>
<label>
<label>
Server-Destination:<br>
- <input value="/dest" ng-model="vm.serverDestination" placeholder="channel">
+ <input value="/dest" ng-model="vm.serverDestination" placeholder="channel"/>
</label>
<br>
<label>
</label>
</div>
- <textarea id="log"></textarea>
-
+ <div>
+ <br>
+ <label>
+ Output Debug:<br>
+ <textarea id="log" style="width: 200%; border: none" auto-height placeholder="log">
+ {{vm.debugLog}}
+ </textarea>
+ </label>
+ </div>
</div>