socket.io-pubsub-3

3.1.5 • Public • Published

socket.io-pubsub

Build Status

How to use

const pubsub = require('@google-cloud/pubsub');
const pubsubClient = pubsub();
const io = require('socket.io')(3000);
const pubsubAdapter = require('socket.io-pubsub');
io.adapter(pubsubAdapter(pubsubClient));

By running socket.io with the socket.io-pubsub adapter you can run multiple socket.io instances in different processes or servers that can all broadcast and emit events to and from each other using Google Cloud Pub/Sub.

If you need to emit events to socket.io instances from a non-socket.io process, you should use socket.io-emitter.

API

adapter(pubsub[, opts])

pubsub is a google-cloud pubsub object.

The following options are allowed:

PubsubAdapter

The pub/sub adapter instances expose the following properties that a regular Adapter does not

  • uid
  • prefix
  • pubsub

License

Apache 2.0

Package Sidebar

Install

npm i socket.io-pubsub-3

Weekly Downloads

6

Version

3.1.5

License

Apache-2.0

Unpacked Size

18.4 kB

Total Files

8

Last publish

Collaborators

  • npsedhain