How to use the rsocket-types.CONNECTION_STATUS.CONNECTING function in rsocket-types

To help you get started, we’ve selected a few rsocket-types 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 rsocket / rsocket-js / packages / rsocket-core / src / RSocketResumableTransport.js View on Github external
connect(): void {
    invariant(
      !this._isTerminated(),
      'RSocketResumableTransport: Cannot connect(), connection terminated (%s: %s).',
      this._status.kind,
      this._status.kind === 'ERROR' ? this._status.error.message : 'no message',
    );
    try {
      this._disconnect();
      this._currentConnection = null;
      this._receiveSubscription = null;
      this._statusSubscription = null;
      this._setConnectionStatus(CONNECTION_STATUS.CONNECTING);
      const connection = this._source();
      connection.connectionStatus().subscribe({
        onNext: status => {
          if (status.kind === this._status.kind) {
            return;
          }
          if (status.kind === 'CONNECTED') {
            if (this._sessionTimeoutHandle) {
              clearTimeout(this._sessionTimeoutHandle);
              this._sessionTimeoutHandle = null;
            }
            //Setup
            if (this._setupFrame == null) {
              this._handleConnected(connection);
              //Resume
            } else {
github rsocket / rsocket-js / packages / rsocket-tcp-client / src / RSocketTcpClient.js View on Github external
connect(): void {
    invariant(
      this.getConnectionState().kind === 'NOT_CONNECTED',
      'RSocketTlsClient: Cannot connect(), a connection is already ' +
        'established.',
    );
    this.setConnectionStatus(CONNECTION_STATUS.CONNECTING);
    const socket = tls.connect(this._options);

    this.setupSocket(socket);
    socket.on('connect', this._handleOpened);
  }
github rsocket / rsocket-js / packages / rsocket-websocket-client / src / RSocketWebSocketClient.js View on Github external
connect(): void {
    invariant(
      this._status.kind === 'NOT_CONNECTED',
      'RSocketWebSocketClient: Cannot connect(), a connection is already ' +
        'established.',
    );
    this._setConnectionStatus(CONNECTION_STATUS.CONNECTING);

    const wsCreator = this._options.wsCreator;
    const url = this._options.url;
    this._socket = wsCreator ? wsCreator(url) : new WebSocket(url);

    const socket = this._socket;
    socket.binaryType = 'arraybuffer';

    (socket.addEventListener: $FlowIssue)('close', this._handleClosed);
    (socket.addEventListener: $FlowIssue)('error', this._handleError);
    (socket.addEventListener: $FlowIssue)('open', this._handleOpened);
    (socket.addEventListener: $FlowIssue)('message', this._handleMessage);
  }

rsocket-types

RSocket types

Apache-2.0
Latest version published 8 months ago

Package Health Score

80 / 100
Full package analysis

Similar packages