title: RxJava - What is the difference between delay and delaySubscription?
body: <p>I am trying to understand the difference between <strong>delay</strong> and <strong>delaySubscription</strong> operators.</p>
  
  <p><a href="http://reactivex.io/documentation/operators/delay.html" rel="noreferrer">This documentation</a> describes <strong>delay</strong> operator:</p>
  
  <blockquote>
    <p>The Delay operator modifies its source Observable by pausing for a
    particular increment of time (that you specify) before emitting each
    of the source Observable’s items. This has the effect of shifting the
    entire sequence of items emitted by the Observable forward in time by
    that specified increment</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/0UUhH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0UUhH.png" alt="enter image description here"></a></p>
  
  <p>delaySubscription is described like this:</p>
  
  <blockquote>
    <p>There is also an operator with which you can delay the subscription to
    the source Observable: delaySubscription.</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/94UZU.png" rel="noreferrer"><img src="https://i.stack.imgur.com/94UZU.png" alt="enter image description here"></a></p>
  
  <p>However, when I tested the behaviour of these 2 operators, it seems to me they are working in the same way.</p>
  
  <p>This is my observable:</p>
  
  <pre><code>Observable observable = Observable.just(5, 3, 4, 2);
  </code></pre>
  
  <p>Here I am using <strong>delay</strong> operator:</p>
  
  <pre><code>observable = observable.delay(3, TimeUnit.SECONDS);
  </code></pre>
  
  <p>This is my observer which logs when one of its methods called</p>
  
  <pre><code>Observer observer = new Observer() {
              @Override
              public void onSubscribe(Disposable d) {
                  Log.d("RxJavaTag", "onSubscribe");
              }
  
              @Override
              public void onNext(Object o) {
                  Log.d("RxJavaTag", "onNext: " + o);
              }
  
              @Override
              public void onError(Throwable e) {
                  Log.d("RxJavaTag", "onError:" + e.toString());
              }
  
              @Override
              public void onComplete() {
                  Log.d("RxJavaTag", "onComplete");
              }
          };
  </code></pre>
  
  <p>Here Observer is subscribing to Observable:</p>
  
  <pre><code>observable.subscribe(observer);
  </code></pre>
  
  <p>In result, I am getting the following log when I am using <strong>delay</strong> operator:</p>
  
  <pre><code>03-25 17:45:34.156 onSubscribe
  03-25 17:45:37.160 onNext: 5
  03-25 17:45:37.160 onNext: 3
  03-25 17:45:37.160 onNext: 4
  03-25 17:45:37.160 onNext: 2
  03-25 17:45:37.160 onComplete
  </code></pre>
  
  <p>And the following log when using <strong>delaySubscription</strong> operator:</p>
  
  <pre><code>03-25 17:49:22.540 onSubscribe
  03-25 17:49:25.544 onNext: 5
  03-25 17:49:25.544 onNext: 3
  03-25 17:49:25.544 onNext: 4
  03-25 17:49:25.544 onNext: 2
  03-25 17:49:25.544 onComplete
  </code></pre>
  
  <p>As you can see in logs, they are working in the same way. I could not understand the difference between them. I tried to test it with ConnectableObservable - the same behaviour.</p>
  
  <p>In my understanding and as its name suggests, should not <strong>delaySubscription</strong> operator work in this way:</p>
  
  <pre><code>[SOME DELAY - FOR EXAMPLE 3 SECONDS]
  03-25 17:49:25.540 onSubscribe
  03-25 17:49:25.544 onNext: 5
  03-25 17:49:25.544 onNext: 3
  03-25 17:49:25.544 onNext: 4
  03-25 17:49:25.544 onNext: 2
  03-25 17:49:25.544 onComplete
  </code></pre>
  
  <p>Maybe I am doing something wrong - but I could not understand the difference. Can you please explain the difference between delay and delaySubscription?</p>