Add all BENNC message types with unit tests
This commit is contained in:
16
src/messages/keepalive.ts
Normal file
16
src/messages/keepalive.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { MessageTypes } from '../common'
|
||||
import { numberToUint16BE } from '../utilities/number'
|
||||
import { packOutgoingPacket } from './packet'
|
||||
|
||||
const MESSAGE_TYPE = numberToUint16BE(MessageTypes.Keepalive)
|
||||
|
||||
/**
|
||||
* Create an outgoing keepalive (0x0005) packet.
|
||||
* @returns An outgoing keepalive (0x0005) packet.
|
||||
*/
|
||||
export function packKeepaliveMessage (): Buffer {
|
||||
return packOutgoingPacket({
|
||||
messageType: MESSAGE_TYPE,
|
||||
data: Buffer.alloc(0)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user