31 lines
650 B
JavaScript
31 lines
650 B
JavaScript
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, cb) {
|
|
|
|
const channelId = "worldChannel";
|
|
this.gcs.leave(channelId, uid, sid);
|
|
|
|
this.chatService.kick(uid, cb);
|
|
cb();
|
|
}
|
|
}
|