module.exports = function(app) { return new ChatRemote(app, app.get('chatService')); } class ChatRemote { constructor(app, chatService) { this.app = app; this.chatService = chatService; this.gcs = this.app.get("globalChannelService"); } add = function (uid, name, channelName, cb) { this.chatService.add(uid, name, channelName, cb); cb(); }; leave = function(uid, channelName, cb) { this.chatService.leave(uid, channelName, cb); cb(); } kick = function(uid, sid, teamId, cb) { const channelId = "worldChannel"; this.gcs.leave(channelId, uid, sid); if (teamId) { const teamChannelId = `teamChannel_${teamId}` this.gcs.leave(teamChannelId, uid, sid); } this.chatService.kick(uid, cb); cb(); } }