braid/dist/server/clients/clientBase.js
2019-03-11 14:35:33 -04:00

30 lines
729 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class ClientBase {
constructor(data, ws) {
this.ws = ws;
this.data = data;
this.id = data.user_id;
this.channel = null;
}
getData() {
return this.data;
}
type() {
return this.data.client_type;
}
connectToChannel(channel) {
this.channel = channel;
this.ws.on('message', (message) => {
channel.broadcastMessage(this, message);
console.log('broadcasted: %s', message);
});
}
replaceWebSocket(ws) {
this.ws.close();
this.ws = ws;
}
}
;
exports.default = ClientBase;
//# sourceMappingURL=clientBase.js.map