# @socket.io/aws-sqs-adapter

> The Socket.IO adapter for AWS Simple Queue Service (SQS), allowing to broadcast events between several Socket.IO servers

Latest version **0.2.0** (published 2026-09-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @socket.io/aws-sqs-adapter
pnpm add @socket.io/aws-sqs-adapter
yarn add @socket.io/aws-sqs-adapter
bun add @socket.io/aws-sqs-adapter
```

## Health

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

Positive: has types; no vulnerabilities; has provenance; recently updated; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2026-09-14 |
| First published | 2024-03-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18.0.0 |
| Dependencies | 4 |
| Unpacked size | 19.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5 |
| Maintainers | darrachequesne |
| Keywords | socket.io, aws, sns, pubsub |

## Links

- npm: https://www.npmjs.com/package/@socket.io/aws-sqs-adapter
- Repository: https://github.com/socketio/socket.io-aws-sqs-adapter
- Homepage: https://github.com/socketio/socket.io-aws-sqs-adapter#readme
- Issues: https://github.com/socketio/socket.io-aws-sqs-adapter/issues
- npm.io page: https://npm.io/package/@socket.io/aws-sqs-adapter

## Dependencies (4)

- [debug](https://npm.io/package/debug.md) ~4.3.4
- [@msgpack/msgpack](https://npm.io/package/@msgpack/msgpack.md) ^2.8.0
- [@aws-sdk/client-sns](https://npm.io/package/@aws-sdk/client-sns.md) ^3.535.0
- [@aws-sdk/client-sqs](https://npm.io/package/@aws-sdk/client-sqs.md) ^3.536.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2026-09-14
- 0.1.1 — 2024-06-11
- 0.1.0 — 2024-03-20

## README

# Socket.IO AWS SQS adapter

The `@socket.io/aws-sqs-adapter` package allows broadcasting packets between multiple Socket.IO servers.

Unlike the existing [`socket.io-sqs`](https://github.com/thinkalpha/socket.io-sqs) package, this package supports binary payloads and dynamic namespaces.

**Table of contents**

- [Supported features](#supported-features)
- [Installation](#installation)
- [Usage](#usage)
- [Options](#options)
- [License](#license)

## Supported features

| Feature                         | `socket.io` version | Support                                        |
|---------------------------------|---------------------|------------------------------------------------|
| Socket management               | `4.0.0`             | :white_check_mark: YES (since version `0.1.0`) |
| Inter-server communication      | `4.1.0`             | :white_check_mark: YES (since version `0.1.0`) |
| Broadcast with acknowledgements | `4.5.0`             | :white_check_mark: YES (since version `0.1.0`) |
| Connection state recovery       | `4.6.0`             | :x: NO                                         |

## Installation

```
npm install @socket.io/aws-sqs-adapter
```

## Usage

```js
import { SNS } from "@aws-sdk/client-sns";
import { SQS } from "@aws-sdk/client-sqs";
import { Server } from "socket.io";
import { createAdapter } from "@socket.io/aws-sqs-adapter";

const snsClient = new SNS();
const sqsClient = new SQS();

const io = new Server({
  adapter: createAdapter(snsClient, sqsClient)
});

// wait for the creation of the SQS queue
await io.of("/").adapter.init();

const gracefulShutdown = async () => {
  // wait for the deletion of the SQS queue and the SNS subscription
  await io.close();
};

process.once("SIGINT", gracefulShutdown);
process.once("SIGTERM", gracefulShutdown);

io.listen(3000);
```

## Options

| Name                     | Description                                                                                                | Default value |
|--------------------------|------------------------------------------------------------------------------------------------------------|---------------|
| `topicArn`               | The ARN of an existing SNS topic to reuse.                                                                 | `-`           |
| `topicName`              | The name of the SNS topic. Ignored if `topicArn` is provided.                                              | `socket-io`   |
| `topicTags`              | The tags to apply to the new SNS topic. Ignored if `topicArn` is provided.                                 | `-`           |
| `queueName`              | A function used to generate the SQS queue name from its random ID.                                         | `-`           |
| `queuePrefix`            | The prefix of the SQS queue. Ignored if `queueName` is provided.                                           | `socket-io`   |
| `queueTags`              | The tags to apply to the new SQS queue.                                                                    | `-`           |
| `sqsMaxNumberOfMessages` | The maximum number of messages to return.                                                                  | `10`          |
| `sqsWaitTimeSeconds`     | The duration (in seconds) for which the call waits for a message to arrive in the queue before returning.  | `5`           |
| `heartbeatInterval`      | The number of ms between two heartbeats.                                                                   | `5_000`       |
| `heartbeatTimeout`       | The number of ms without heartbeat before we consider a node down.                                         | `10_000`      |

## License

[MIT](LICENSE)

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