Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #194 from hosmelq/master
Browse files Browse the repository at this point in the history
fix error when room is undefined
  • Loading branch information
tlaverdure authored Aug 23, 2017
2 parents 51a39cb + d113d14 commit 66bbbc5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/api/http-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ export class HttpApi {
getChannel(req: any, res: any): void {
var channelName = req.params.channelName;
var room = this.io.sockets.adapter.rooms[channelName];
var subscriptionCount = room ? room.length : 0;

var result = {
subscription_count: room.length,
occupied: true
subscription_count: subscriptionCount,
occupied: !!subscriptionCount
};

if (this.channel.isPresence(channelName)) {
Expand Down

0 comments on commit 66bbbc5

Please sign in to comment.