How to use the @ssv/signalr-client.ConnectionStatus.connected function in @ssv/signalr-client

To help you get started, we’ve selected a few @ssv/signalr-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / data / live.tsx View on Github external
// directly on the hub, which is managed with normal classes
      // instead of waiting for react-render lifecycles
      if (hub['hubConnection'].state !== ConnectionStatus.connected) {
        /* private field. YOLO */
        return;
      }

      try {
        hub.send('UnsubscribeFrom', subscribeTo);
      } catch (e) {
        console.log(
          'tried to unsubscribe: ',
          subscribeTo,
          isConnected,
          hub['hubConnection'].state,
          ConnectionStatus.connected
        );

        throw e;
      }
    };
  }, [subscribeTo, isConnected, isSubscribed, hub]);
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / data / live.tsx View on Github external
return () => {
      if (subscription.current) {
        subscription.current.unsubscribe();
      }

      if (!isConnected) return;
      // NOTE: isConnected from the context provider doesn't
      // propagate its update quick enough for this particular value
      // of this particular copy of the reference to be correct /
      // the most up to date. So we need to access the state
      // directly on the hub, which is managed with normal classes
      // instead of waiting for react-render lifecycles
      if (hub['hubConnection'].state !== ConnectionStatus.connected) {
        /* private field. YOLO */
        return;
      }

      try {
        hub.send('UnsubscribeFrom', subscribeTo);
      } catch (e) {
        console.log(
          'tried to unsubscribe: ',
          subscribeTo,
          isConnected,
          hub['hubConnection'].state,
          ConnectionStatus.connected
        );

        throw e;
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / sockets / data-socket.tsx View on Github external
(state) => {
          if (this.isDestroying) return;

          this.setState({
            isConnected: state.status === ConnectionStatus.connected,
            connectionState: state,
          });
        }
      );

@ssv/signalr-client

SignalR client library built on top of @microsoft/signalr. This gives you more features and easier to use.

MIT
Latest version published 9 months ago

Package Health Score

59 / 100
Full package analysis