Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

primus-rooms-metroplex-adapter

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

primus-rooms-metroplex-adapter

primus-rooms adapter for metroplex

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

primus-rooms-metroplex-adapter

Build Status NPM version Test Coverage

Adapter for primus-room

  • Backed by redis
  • Depends on metroplex & omega-supreme
  • Sets expired keys, so it can gracefully recover if a server goes down
  • Uses scan and sscan to avoid blocking the server for large datasets

Installation

npm install --save primus-rooms-metroplex-adapter
const PrimusRoomsMetroplexAdapter = require('primus-rooms-metroplex-adapter')

// initialize primus with required plugins

const primus = new Primus(server, {
  transformer: 'engine.io',
  middleware: omegaSupremeRoomsMiddleware(),
  redis
})

primus.plugin('omega-supreme', omegaSupreme)
primus.plugin('metroplex', metroplex)
primus.plugin('rooms', primusRooms)

// configure & initialize adapter

const roomsAdapter = new PrimusRoomsMetroplexAdapter(redis, primus)
primus.adapter = roomsAdapter
primus._rooms.adapter = roomsAdapter // apparently a necessary hack
roomsAdapter.initialize()

Redis Data Schema

KeyTypeValues
room_manager:rooms:$serverId_$instanceId:$roomset$sparkId
  • Used for finding all of the sparks belonging to a room
  • TTL is refreshed periodically, similar to metroplex's expiration refresh algorithm
  • Includes the $serverId so that it can expire if the server goes down
KeyTypeValues
room_manager:sparks:$sparkIdset$roomId
  • Used for finding the rooms a given spark id belongs to
  • TTL is refreshed each time a heartbeat event is received from a spark

Keywords

FAQs

Package last updated on 08 Mar 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc