Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/socketio/socket.io-aws-sqs-adapter
The Socket.IO adapter for AWS Simple Queue Service (SQS), allowing to broadcast events between several Socket.IO servers.
https://github.com/socketio/socket.io-aws-sqs-adapter
aws aws-sqs socket-io
Last synced: about 1 month ago
JSON representation
The Socket.IO adapter for AWS Simple Queue Service (SQS), allowing to broadcast events between several Socket.IO servers.
- Host: GitHub
- URL: https://github.com/socketio/socket.io-aws-sqs-adapter
- Owner: socketio
- License: mit
- Created: 2024-03-20T15:01:33.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-21T04:10:56.000Z (8 months ago)
- Last Synced: 2024-05-09T08:17:16.316Z (6 months ago)
- Topics: aws, aws-sqs, socket-io
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@socket.io/aws-sqs-adapter
- Size: 47.9 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
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();io.listen(3000);
```## Options
| Name | Description | Default value |
|---------------------|--------------------------------------------------------------------|---------------|
| `topicName` | The name of the SNS topic. | `socket.io` |
| `topicTags` | The tags to apply to the new SNS topic. | `-` |
| `queuePrefix` | The prefix of the SQS queue. | `socket.io` |
| `queueTags` | The tags to apply to the new SQS queue. | `-` |
| `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)