"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var logger = require('../logger');
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;
    }
    clientType() {
        return this.data.client;
    }
    connectToChannel(channel) {
        this.channel = channel;
        this.ws.on('message', (message) => {
            logger.accessLog.info(`starting broadcast on channel ${channel.id}: `, { message: message });
            channel.broadcastMessage(this, message);
            logger.accessLog.info(`broadcast complete on channel ${channel.id}: `, { message: message });
        });
    }
    replaceWebSocket(ws) {
        this.ws.close();
        this.ws = ws;
    }
}
;
exports.default = ClientBase;
//# sourceMappingURL=clientBase.js.map