pub fn encode_packet(input: &Packet) -> Vec<u8> ⓘ
Expand description
Encode a packet with binary data to a byte array.
§Arguments
input
- Apacket
with binary data
§Example
use engine_io_parser::packet::{Packet, PacketData, PacketType};
use engine_io_parser::binary::encoder::*;
assert_eq!(
encode_packet(&Packet {
packet_type: PacketType::Message,
data: vec![16u8, 8u8, 4u8, 2u8].into(),
}),
b"\x04\x10\x08\x04\x02"
);