调用stop后启动SignalR连接

时间:2017-07-02 11:41:41

标签: javascript signalr

我在客户端的SignalRService类中有两个方法:

for file in $Data
do
    echo "No white space [$file]"
    ls -l "$file"
done

初始化在构造函数中进行,如下所示:

public startConnection(): void {  

    this.connection.start().done((data: any) => {  
        console.log('Now connected ' + data.transport.name + ', connection 
ID= ' + data.id);  
        //this.connectionEstablished.emit(true);  
        this.connectionExists = true;  
    }).fail((error: any) => {  
        console.log('Could not connect ' + error);  
        //this.connectionEstablished.emit(false);  
    });  
    }  

    public stopConnection():void {
        this.connection.stop();
            console.log('Stop connection');  
    }

我需要在停止后再次调用start但它失败但异常:

 this.connection = $.hubConnection(environment.apiUrl);  
    this.connection.qs = "Bearer="+this._authService.getToken();
    // create new proxy as name already given in top  
    this.proxy = this.connection.createHubProxy(this.proxyName);

请帮帮我吧!

0 个答案:

没有答案
相关问题