func (codec Websocket) Encode(payload packet.Payload, writer io.Writer) error {
	if len(payload) == 0 {
		return nil
	}

	for _, packet := range payload {
		err := codec.encodePacket(packet, writer)

		if err != nil {
			return err
		}
	}

	return nil
}
// Encode encodes a single packet in payload
Encode encodes a single packet in payload
// Encode encodes a single packet in payload
func (codec Websocket) Encode(payload packet.Payload, writer io.Writer) error {
	if len(payload) == 0 {
		return nil
	}
	for _, packet := range payload {
		err := codec.encodePacket(packet, writer)
		if err != nil {
			return err
		}
	}
	return nil
}
func ( codec Websocket ) Encode ( payload packet . Payload , writer io . Writer ) error { if len ( payload ) == 0 { return nil } for _ , packet := range payload { err := codec . encodePacket ( packet , writer ) if err != nil { return err } } return nil }
Encode encodes a single packet in payload
Encode encodes a single packet in payload