SignalR: Detecting Alive Connection in C# clients

后端 未结 2 1161
天命终不由人
天命终不由人 2021-01-02 00:42

I am currently developing an application using SignalR (2.1) Hubs.

I have 1 WPF client and the other is a WCF client. Everything works fine in that they are passing

2条回答
  •  爱一瞬间的悲伤
    2021-01-02 01:06

    I found that my Client would not reconnect if I forced the Server to shut down the connection. (I'd get a WSSockets error)

    So, for me, the fix was:

    con = new HubConnection(_url);
    con.Error += (exception) => Error(exception);
    con.Start();
    

    then, in the Error method, attempt to reconnect by calling the above code again.

提交回复
热议问题