A Subject is a sort of bridge or proxy that is available in some implementations of ReactiveX that acts both as an observer and as an Observable.

Subject는 관찰자와 Observable 역할을 모두 수행하는 ReactiveX의 일부 구현에서 사용할 수 있는 일종의 브리지 또는 프록시입니다.

Because it is an observer, it can subscribe to one or more Observables, and because it is an Observable, it can pass through the items it observes by reemitting them, and it can also emit new items.

옵저버이기 때문에 하나 이상의 옵저버블을 구독 할 수 있고, 옵저버블이기 때문에 관찰한 항목을 재발송하여 통과 할 수 있으며 새 항목을 내보낼 수도 있습니다.

Because a Subject subscribes to an Observable, it will trigger that Observable to begin emitting items (if that Observable is “cold” — that is, if it waits for a subscription before it begins to emit items).

Subject는 Observable을 구독하기 때문에 Observable이 항목 방출을 시작하도록 트리거합니다 (Observable이 "cold"인 경우, 즉 항목을 방출하기 전에 구독을 기다리는 경우).

This can have the effect of making the resulting Subject a “hot” Observable variant of the original “cold” Observable.

이것은 결과로 생성된 피험자를 원래의 "차가운" Observable의 "hot" Observable 변형으로 만드는 효과를 가질 수 있습니다.


Varieties of Subject

There are four varieties of Subject that are designed for particular use cases.

특정 사용 사례를 위해 설계된 네 가지 종류의 주제가 있습니다.

Not all of these are available in all implementations, and some implementations use other naming conventions (for example, in RxScala, what is called a “PublishSubject” here is known simply as a “Subject”):