mirror of
https://git.sr.ht/~emerson/reflectionircd
synced 2025-04-13 09:59:52 +00:00
21 lines
No EOL
581 B
TypeScript
21 lines
No EOL
581 B
TypeScript
import { Socket } from "net";
|
|
import { Client } from "./Client.js";
|
|
import { IRCServer } from './Server.js';
|
|
|
|
export class IRCClient extends Client {
|
|
constructor(private socket: Socket , public server: IRCServer) {
|
|
super(server);
|
|
this.socket.on('data', (data) => this.receiveData(data));
|
|
this.socket.on('close', (e) => {this.closeConnection()});
|
|
this.server.doLog("New IRCClient connected");
|
|
}
|
|
|
|
writeMessage(message: string) {
|
|
//console.log(`SENT: ${msgToSend}`);
|
|
this.socket.write(`${message}\r\n`);
|
|
}
|
|
|
|
closeConnection() {
|
|
this.socket.destroy();
|
|
}
|
|
} |