pinusmod-kcp
Version:
kcp 的 connector (基于 node-kcp-x)
15 lines (14 loc) • 533 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.handle = void 0;
const pinusmod_protocol_1 = require("pinusmod-protocol");
function handle(socket, reason) {
// websocket close code 1000 would emit when client close the connection
if (typeof reason === 'string') {
let res = {
reason: reason
};
socket.sendRaw(pinusmod_protocol_1.Package.encode(pinusmod_protocol_1.Package.TYPE_KICK, Buffer.from(JSON.stringify(res))));
}
}
exports.handle = handle;