如何在Angular上使用Jasmine模拟Stomp over WebSocket

时间:2016-11-15 16:38:24

标签: angularjs websocket jasmine stomp

我通过WebSocket与Stomp连接,看起来像是

var authenticity_token = {authenticity_token: $cookies.get('XSRF-TOKEN')};
  var ws = new WebSocket(GlobalSettings.STOMP_URL);
  var stomp = Stomp.over(ws);

  $scope.allRequests = [];
  stomp.connect( {}, authenticity_token, function(){
    $scope.allRequests.forEach(function(requestId){
      stomp.subscribe('/stomplets/eventable/update/request/id=' + requestId, function(message){
        $scope.liveUpdateState(JSON.parse(message.body));
      });
    });
  });

但我不知道如何测试。请帮帮我。

0 个答案:

没有答案