from src.packet.ArrayBuffer import ArrayBuffer
from src.packet.NetPacker import NetPacker

class UpdatePing:

	def __init__(self):
		self.buffer = ArrayBuffer()
		self.packer = NetPacker(self.buffer)

	def build(self, handler, payload, isBinary):
		self.handler = handler
		self.payload = payload
		self.isBinary = isBinary
		self.buildMessage()
		self.sendData()

	def buildMessage(self):
		self.packer.addUint8(224) # Ping messageType

	def sendData(self):
		self.handler.sendMessage(self.buffer.getData(), self.isBinary)