# @types/sc-channel

> TypeScript definitions for sc-channel

Latest version **2.0.4** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/sc-channel
pnpm add @types/sc-channel
yarn add @types/sc-channel
bun add @types/sc-channel
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.4 |
| Published | 2023-11-07 |
| First published | 2018-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51446 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/sc-channel
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sc-channel
- npm.io page: https://npm.io/package/@types/sc-channel

## Dependencies (2)

- [@types/stream-demux](https://npm.io/package/@types/stream-demux.md) *
- [@types/async-iterable-stream](https://npm.io/package/@types/async-iterable-stream.md) *

## Recent versions

- 2.0.4 (latest) — 2023-11-07
- 2.0.1 (ts3.8) — 2021-07-09
- 2.0.0 (ts3.1) — 2020-02-05
- 1.2.0 (ts2.4) — 2018-12-05
- 1.2.6 — 2026-09-02
- 1.2.5 — 2023-11-07
- 1.2.4 — 2023-10-18
- 2.0.3 — 2023-10-18
- 1.2.3 — 2023-09-25
- 2.0.2 — 2023-09-25
- 1.2.2 — 2021-07-06
- 1.2.1 — 2020-02-05

## README

# Installation
> `npm install --save @types/sc-channel`

# Summary
This package contains type definitions for sc-channel (https://github.com/SocketCluster/sc-channel).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sc-channel.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sc-channel/index.d.ts)
````ts
import AsyncIterableStream = require("async-iterable-stream");
import StreamDemux = require("stream-demux");
import DemuxedConsumableStream = require("stream-demux/demuxed-consumable-stream");

declare class SCChannel<T> extends AsyncIterableStream<T> {
    readonly PENDING: "pending";
    readonly SUBSCRIBED: "subscribed";
    readonly UNSUBSCRIBED: "unsubscribed";

    name: string;
    client: SCChannel.Client;

    state: SCChannel.ChannelState;
    options: object;

    constructor(name: string, client: SCChannel.Client, eventDemux: StreamDemux<T>, dataStream: AsyncIterableStream<T>);

    createAsyncIterator(timeout?: number): AsyncIterableStream.AsyncIterator<T>;

    listener(eventName: string): DemuxedConsumableStream<T>;
    closeListener(eventName: string): void;
    closeAllListeners(): void;

    close(): void;

    subscribe(options?: any): void;
    unsubscribe(): void;

    isSubscribed(includePending?: boolean): boolean;

    publish(data: any): any;
}

export = SCChannel;

declare namespace SCChannel {
    interface Client {
        closeChannel(channelName: string): void;

        getChannelState(channelName: string): ChannelState;
        getChannelOptions(channelName: string): object;

        subscribe(channelName: string): SCChannel<any>;
        unsubscribe(channelName: string): void;
        isSubscribed(channelName: string, includePending?: boolean): boolean;

        publish(channelName: string, data: any): any;
    }

    type ChannelState = "pending" | "subscribed" | "unsubscribed";
}

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 20:08:00 GMT
 * Dependencies: [@types/async-iterable-stream](https://npmjs.com/package/@types/async-iterable-stream), [@types/stream-demux](https://npmjs.com/package/@types/stream-demux)

# Credits
These definitions were written by [Daniel Rose](https://github.com/DanielRose).

---
_Source: https://npm.io/package/@types/sc-channel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
