# createChannel

```ts
function createChannel<T, TClose = void>(): Channel<T, TClose>
```

Create a new [Channel](https://frontside.com/effection/api/v3/Channel.md). Use channels to communicate between operations.
In order to dispatch messages from outside an operation such as from a
callback, use [Signal](https://frontside.com/effection/api/v3/Signal.md).

See [the guide on Streams and
Subscriptions](https://frontside.com/effection/docs/guides/collections)
for more details.

### Examples
#### Example 1
``` javascript
import { main, createChannel } from 'effection';

await main(function*() {
  let channel = createChannel();

  yield* channel.send('too early'); // the channel has no subscribers yet!

  let subscription1 = yield* channel;
  let subscription2 = yield* channel;

  yield* channel.send('hello');
  yield* channel.send('world');

  console.log(yield* subscription1.next()); //=> { done: false, value: 'hello' }
  console.log(yield* subscription1.next()); //=> { done: false, value: 'world' }
  console.log(yield* subscription2.next()); //=> { done: false, value: 'hello' }
  console.log(yield* subscription2.next()); //=> { done: false, value: 'world' }
});
```
---
### Type Parameters
T


TClose = void


### Return Type


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

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