node-ws-packets
Version:
A packet-based javascript websocket communitcation.
31 lines (28 loc) • 581 B
JavaScript
/**
* Imports
*/
const Packet = require("../Packet.js");
/**
* Create Packet
*/
module.exports = class CKeepAlivePacket extends Packet {
constructor(payload) {
/*
Packet Timestamp
*/
const model = {
timestamp: Number
}
/*
Init Packet
*/
super("IKeepAlivePacket", payload, model);
}
/**
* Handle packet
* @param {object} ws websocket connection
*/
handle(ws) {
ws.sendPacket(new CKeepAlivePacket({ timestamp: this.payload.timestamp }));
}
}