using DotNetty.Buffers; using DotNetty.Codecs; using DotNetty.Transport.Channels; using HybirdFrameworkDriver.Common; using HybirdFrameworkDriver.Session; namespace Service.Charger.Codec; public class Encoder : MessageToByteEncoder { protected override void Encode(IChannelHandlerContext context, IToBytes obj, IByteBuffer output) { int sn = (int)SessionMgr.GetAttrByKey(context.Channel.Id.ToString(), "charger_sn"); output.WriteBytes(obj.ToBytes()); } }