# @types/rails__actioncable

> TypeScript definitions for @rails/actioncable

Latest version **8.0.3** (published 2025-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/rails__actioncable
pnpm add @types/rails__actioncable
yarn add @types/rails__actioncable
bun add @types/rails__actioncable
```

## Health

**Score 65/100 (B)** — status: stable.

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

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 8.0.3 |
| Published | 2025-10-27 |
| First published | 2021-03-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51430 |
| Maintainers | types |

## Links

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

## Recent versions

- 8.0.3 (latest) — 2025-10-27
- 6.1.11 (ts5.1) — 2024-06-28
- 6.1.10 (ts4.5) — 2023-11-22
- 6.1.6 (ts4.4) — 2021-11-18
- 6.1.5 (ts3.6) — 2021-07-08
- 6.1.0 (ts3.5) — 2021-03-07
- 8.0.2 — 2025-10-26
- 8.0.1 — 2025-10-26
- 8.0.0 — 2025-10-16
- 6.1.9 — 2023-11-07
- 6.1.8 — 2023-10-18
- 6.1.7 — 2023-09-27
- 6.1.4 — 2021-04-02
- 6.1.3 — 2021-04-01
- 6.1.2 — 2021-03-21
- … 1 more at https://npm.io/package/@types/rails__actioncable/versions

## README

# Installation
> `npm install --save @types/rails__actioncable`

# Summary
This package contains type definitions for @rails/actioncable (https://github.com/rails/rails/blob/main/actioncable/app/javascript/action_cable).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/rails__actioncable.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/rails__actioncable/index.d.ts)
````ts
export as namespace ActionCable;

export interface ChannelNameWithParams {
    channel: string;
    [key: string]: any;
}

/**
 * @see https://github.com/rails/rails/blob/8-0-stable/actioncable/app/javascript/action_cable/adapters.js
 */
export const adapters: {
    logger: Console;
    WebSocket: typeof WebSocket;
};

/**
 * @see https://github.com/rails/rails/blob/8-0-stable/actioncable/app/javascript/action_cable/consumer.js
 */
export class Consumer {
    readonly subscriptions: Subscriptions;
    readonly subprotocols: string[];

    constructor(url: string);
    get url(): string;
    connect(): boolean;
    disconnect(): void;
    addSubProtocol(protocol: string): void;
}

export interface BaseMixin {
    connected?(arg: { reconnected: boolean }): void;
    disconnected?(arg: { willAttemptReconnect: boolean | undefined }): void;
    initialized?(): void;
    rejected?(): void;
    received?(data: any): void;
}

/**
 * @see https://github.com/rails/rails/blob/8-0-stable/actioncable/app/javascript/action_cable/subscription.js
 */
export class Subscription<M extends BaseMixin = BaseMixin> {
    readonly identifier: string;

    constructor(consumer: Consumer, params: ChannelNameWithParams, mixin: M);
    perform(action: string, data?: object): boolean;
    send(data: any): boolean;
    unsubscribe(): this;
}

/**
 * @see https://github.com/rails/rails/blob/8-0-stable/actioncable/app/javascript/action_cable/subscriptions.js
 */
export class Subscriptions {
    constructor(consumer: Consumer);
    create<M extends BaseMixin = {}>(
        channelName: string | ChannelNameWithParams,
        mixin?: M & ThisType<Subscription & M>,
    ): Subscription & M;
}

/**
 * @see https://github.com/rails/rails/blob/8-0-stable/actioncable/app/javascript/action_cable/logger.js
 */
export const logger: {
    log(...messages: any[]): void;
    enabled?: boolean | undefined;
};

/**
 * @see https://github.com/rails/rails/blob/8-0-stable/actioncable/app/javascript/action_cable/index.js
 */
export function createConsumer(url?: string | (() => string)): Consumer;

````

### Additional Details
 * Last updated: Mon, 27 Oct 2025 06:43:23 GMT
 * Dependencies: none

# Credits
These definitions were written by [Martin Badin](https://github.com/martin-badin), and [Shunichi Ikegami](https://github.com/shunichi).

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