31 lines
455 B
JavaScript
31 lines
455 B
JavaScript
// Uplink Gemini Server
|
|
// Response Class
|
|
|
|
module.exports = class Response {
|
|
constructor() {
|
|
this.socket = undefined;
|
|
this.status = undefined;
|
|
}
|
|
|
|
setSocket(socket) {
|
|
this.socket = socket;
|
|
}
|
|
|
|
getSocket() {
|
|
return this.socket;
|
|
}
|
|
|
|
send(data) {
|
|
this.status = 20;
|
|
this.socket.write(data);
|
|
}
|
|
|
|
error(code) {
|
|
this.status = code;
|
|
this.socket.write(`${code} Error\r\n`);
|
|
}
|
|
|
|
end() {
|
|
this.socket.end();
|
|
}
|
|
}; |