angularjs - Closing a WebSocket properly -


when close websocket(ws.$close()) in angularjs application takes 40 seconds until closes , receive onclose event. using ng-websocket library. simple test code example:

angular.module("mainmodule").controller("maincontroller", function ($scope, $http, $websocket, $rootscope) {     $scope.dataimage = "#";     $scope.websocket = null;      $scope.testwebsocket = function () {         $scope.websocket = $websocket.$new({             url: 'ws://someurl',             reconnect: true         });          $scope.websocket.$on('$message', $scope.imagearrived);     }      $scope.closewebsocket = function () {         $scope.websocket.$un('$message');         $scope.websocket.$close();         $scope.dataimage = "#";     }      $scope.imagearrived = function (imagemessage) {         console.log("image arrived");         $scope.dataimage = "data:image/gif;base64," + imagemessage.data;         $rootscope.$apply();     } }); 

i created wpf test application using websockets , there receive onclose event immediately. there way speed closing of websocket?


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -