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

socket.io-hotel

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

socket.io-hotel - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

2

lib/socket.io-hotel.js

@@ -33,3 +33,3 @@ _ = require('underscore')

Hotel.prototype.delEmptyRoom = function(roomID, clbk) {
if(_.isEmpty(this.adapter.rooms[roomID])){
if(!this.adapter.rooms[roomID][roomID]){
delete this.adapter.rooms[roomID]

@@ -36,0 +36,0 @@ delete this.adapter.rooms_props[roomID];

{
"name": "socket.io-hotel",
"version": "0.2.1",
"version": "0.2.2",
"description": "socket.io-hotel is a manager that adds new features and functionalities to socket.io's rooms",

@@ -5,0 +5,0 @@ "scripts": {

@@ -12,3 +12,4 @@ ##socket.io-hotel

```javascript
io = require('socket.io')(http)
io = require('socket.io')(http),
Hotel = require('socket.io-hotel')
//...

@@ -20,22 +21,20 @@ var hotel = new Hotel(io.sockets.adapter)

---
`setPropertyRoom(roomID, key, val, clbk)`
####setPropertyRoom(roomID, key, val, clbk)
sets a new property [val: key] to the room . clbk receives an object with the rooms' properties modified
`delRoomProperty(roomID, key, clbk)`
####delRoomProperty(roomID, key, clbk)
deletes a specific property from the room. callback receives an object with the rooms' properties object modified
`getPropertiesRoom(roomID, clbk)`
####getPropertiesRoom(roomID, clbk)
callback receives all properties from a give object
`listRooms = function(clbk)`
####listRooms = function(clbk)
calback receives a list with all rooms
`getUsersRoom = function(roomID, clbk)`
####getUsersRoom = function(roomID, clbk)
callback receives all users from a given room
`delEmptyRoom = function(roomID, clbk)`
####delEmptyRoom = function(roomID, clbk)
if room is empty, delete it. callback returns `true` if the room was deleted and `false` otherwise
`roomExists = function(roomID, clbk)`
callback receives `true` if room exists. `false` otherwise

@@ -16,4 +16,4 @@ var test = require('tape'),

rooms: {
room1: ['user1'],
room2: ['user1', 'user2'],
room1: {'room1':{room1:true}},
room2: {'room2':{room2:true}, 'room1':{room1:true}},
emptyRoom: []

@@ -57,3 +57,3 @@ },

hotel.removeRoomProperty('room1','color',function(properties){
hotel.delRoomProperty('room1','color',function(properties){
t.equal(properties.color,undefined,'color was removed from room 1');

@@ -60,0 +60,0 @@ t.equal(_.size(properties),2, 'room 1 has 2 properties')

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