我的条件满足后,如何用Automatic Reconnect处理或销毁?无论我try 什么,该方法每次都会执行.
const connection = new signalR.HubConnectionBuilder()
.withUrl(socketServerUrl, {
withCredentials: false,
skipNegotiation: true,
transport: signalR.HttpTransportType.WebSockets,
})
.withAutomaticReconnect({
nextRetryDelayInMilliseconds: ({ elapsedMilliseconds }) => {
// function content
},
})
.configureLogging(signalR.LogLevel.Information)
.build();
if (isGameSessionExpired) {
// Looking for something like that, but didn't work
connection.stop();
connection.withAutomaticReconnect(null);
connection = null;
}