Многократные Соединения SinalR - PullRequest
0 голосов
/ 17 апреля 2020

Я использую два сервиса SignalR в одном проекте. У context.ConnectionId возник конфликт и отключено одно из соединений SignalR. Как я могу поддерживать два соединения SignalR одновременно? Код для одного соединения SignalR:

methods: {
      cVueComponent: async function cVueComponent() {
          var _this = this;
          if (connection == null) {
              connection = new signalR.HubConnectionBuilder()
                  .withUrl(signalRHost + "/servicehub")
                  .configureLogging(signalR.LogLevel.Information)
                  .build();
          }
          connection.on("ReceiveUpdates", (response) => {                  
              _this.tUpdates = response;
          }
          );
          connection.onclose(() => start());
          if (connection.state === signalR.HubConnectionState.Disconnected) {
              await connection.start({ withCredentials: false })                   
                  .then(() => {
                      console.assert(connection.state === signalR.HubConnectionState.Connected);
                      console.log('Hub Connection started');
                      connection.invoke("GetUpdates", user);
                  })
                  .catch(err =>
                      console.error('Error while starting Hub connection:' + err.toString())
                  );
          }
      }

Спасибо!

...