Socket
Book a DemoInstallSign in
Socket

@boardgame.io/redis-pubsub

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boardgame.io/redis-pubsub

Redis pub/sub adapter for boardgame.io

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
4
Created
Source

@boardgame.io/redis-pubsub

This package provides a Redis pub/sub adapter for boardgame.io.

Installation

npm install @boardgame.io/redis-pubsub

Requirements

Requires redis npm library 3.1.2 or greater (docs), and boardgame.io version 0.47.0 or greater (docs). Using a database adaptor (i.e. postgres) that stores and shares the state across servers is also required to properly horizontally scale them.

Usage

import { RedisPubSub } from 'bgio-redis-pubsub'
import { Server, Origins, SocketIO } from 'boardgame.io/server';
import MyGame from './src/MyGame';
import redis from 'redis';
import { PostgresStore } from 'bgio-postgres';

const redisConfig = { host: '192.168.8.50' };
const pubClient = redis.createClient(redisConfig);
const subClient = pubClient.duplicate();
const server = Server({
  games: [MyGame],
  db: new PostgresStore('vdf@192.168.8.50/vdf'),
  origins: [Origins.LOCALHOST],
  transport: new SocketIO({
    pubSub: new RedisPubSub(pubClient, subClient),
  }),
});
server.run(8000);

Keywords

boardgame.io

FAQs

Package last updated on 15 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts