absenat
Version:
dedicated messaging service core
28 lines (27 loc) • 621 B
JavaScript
io = require('socket.io')();
ioClient = require('socket.io-client');
chalk = require('chalk');
module.exports = class Absenat {
constructor() {
this.port = null;
this.nickname = null;
const methods = require('./methods');
methods.init();
}
/**
* @param {string} nickname
* sets node nickname for node
*/
setNickname(nickname) {
this.nickname = nickname;
}
/**
* @param {number} port
* starts socket connection in entered port
*/
startConnection(port) {
this.port = port;
io.listen(this.port);
console.log(chalk.yellow(`listening on ${this.port}`));
}
};