auto reconnect when connect aria2 via websocket
This commit is contained in:
parent
b57381cb0c
commit
317348ebbd
|
@ -13,6 +13,7 @@
|
|||
defaultHost: 'localhost',
|
||||
defaultSecureProtocol: 'https',
|
||||
defaultPathSeparator: '/',
|
||||
websocketAutoReconnect: true,
|
||||
globalStatStorageCapacity: 120,
|
||||
taskStatStorageCapacity: 300,
|
||||
lazySaveTimeout: 500,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('ariaNg').factory('aria2WebSocketRpcService', ['$q', '$websocket', 'ariaNgSettingService', 'ariaNgLogService', function ($q, $websocket, ariaNgSettingService, ariaNgLogService) {
|
||||
angular.module('ariaNg').factory('aria2WebSocketRpcService', ['$q', '$websocket', 'ariaNgConstants', 'ariaNgSettingService', 'ariaNgLogService', function ($q, $websocket, ariaNgConstants, ariaNgSettingService, ariaNgLogService) {
|
||||
var rpcUrl = ariaNgSettingService.getCurrentRpcUrl();
|
||||
var socketClient = null;
|
||||
|
||||
|
@ -72,7 +72,9 @@
|
|||
var getSocketClient = function (context) {
|
||||
if (socketClient === null) {
|
||||
try {
|
||||
socketClient = $websocket(rpcUrl);
|
||||
socketClient = $websocket(rpcUrl, {
|
||||
reconnectIfNotNormalClose: ariaNgConstants.websocketAutoReconnect
|
||||
});
|
||||
|
||||
socketClient.onMessage(function (message) {
|
||||
if (!message || !message.data) {
|
||||
|
|
Reference in a new issue