`encodePacket` is more efficient in this case so we can leverage the WS framing