๐Ÿ“ฆ socketio / socket.io-azure-service-bus-adapter

The Socket.IO adapter for Azure Service Bus, allowing to broadcast events between several Socket.IO servers.

โ˜… 5 stars โ‘‚ 4 forks ๐Ÿ‘ 5 watching โš–๏ธ MIT License
azureazure-service-bussocket-io
๐Ÿ“ฅ Clone https://github.com/socketio/socket.io-azure-service-bus-adapter.git
HTTPS git clone https://github.com/socketio/socket.io-azure-service-bus-adapter.git
SSH git clone git@github.com:socketio/socket.io-azure-service-bus-adapter.git
CLI gh repo clone socketio/socket.io-azure-service-bus-adapter
Damien Arrachequesne Damien Arrachequesne chore(release): 0.1.0 a78c1b7 1 years ago ๐Ÿ“ History
๐Ÿ“‚ main View all commits โ†’
๐Ÿ“ .github
๐Ÿ“ lib
๐Ÿ“ test
๐Ÿ“„ .gitignore
๐Ÿ“„ CHANGELOG.md
๐Ÿ“„ LICENSE
๐Ÿ“„ package-lock.json
๐Ÿ“„ package.json
๐Ÿ“„ README.md
๐Ÿ“„ tsconfig.json
๐Ÿ“„ README.md

Socket.IO Azure Service Bus adapter

The @socket.io/azure-service-bus-adapter package allows broadcasting packets between multiple Socket.IO servers.

Table of contents

Supported features

Featuresocket.io versionSupport
Socket management4.0.0:whitecheckmark: YES (since version 0.1.0)
Inter-server communication4.1.0:whitecheckmark: YES (since version 0.1.0)
Broadcast with acknowledgements4.5.0:whitecheckmark: YES (since version 0.1.0)
Connection state recovery4.6.0:x: NO

Installation

npm install @socket.io/azure-service-bus-adapter

Usage

import { ServiceBusClient, ServiceBusAdministrationClient } from "@azure/service-bus";
import { Server } from "socket.io";
import { createAdapter } from "@socket.io/azure-service-bus-adapter";

const connectionString = "Endpoint=...";

const serviceBusClient = new ServiceBusClient(connectionString);
const serviceBusAdminClient = new ServiceBusAdministrationClient(connectionString);

const io = new Server({
  adapter: createAdapter(serviceBusClient, serviceBusAdminClient)
});

// wait for the creation of the pub/sub subscription
await io.of("/").adapter.init();

io.listen(3000);

Options

NameDescriptionDefault value
topicNameThe name of the topic.socket.io
topicOptionsThe options used to create the topic.-
subscriptionPrefixThe prefix of the subscription (one subscription will be created per Socket.IO server in the cluster).socket.io
receiverOptionsThe options used to create the subscription.-
topicOptionsThe options used to create the receiver.-
heartbeatIntervalThe number of ms between two heartbeats.5_000
heartbeatTimeoutThe number of ms without heartbeat before we consider a node down.10_000

License

MIT