# subscribe

```ts
function subscribe<T, R>(iter: AsyncIterator<T, R>): Subscription<T, R>
```

Convert any [`AsyncIterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator) into an effection [Subscription](https://frontside.com/effection/api/v3/Subscription.md)

This allows you to consume any `AsyncIterator` as a [Subscription](https://frontside.com/effection/api/v3/Subscription.md).

### Type Parameters
T


R


### Parameters


**iter**: AsyncIterator&lt;T, R&gt;


the iterator to convert
### Return Type


[Subscription](https://frontside.com/effection/api/v3/Subscription.md)&lt;T, R&gt;


a subscription that will produce each item of `iter`

[View code](https://github.com/thefrontside/effection/tree/effection-v3.6.1/lib/async.ts#L13)
