Selective compression possible

We use RO SDK on .NET
We use SuperHTTP as channel and BinMessage as message type.

For most data we transfer the “UseCompression := true;” is a good thing, but we also send png files as Binary.
png files are already compressed using ZLib, so trying to compress it again has no use except buring cpu cycles…
Is there a way (custom attribute??) to tell a certain method not to use compression when sending data?

Best Regards,

Jeroen

Hello

This is possible. What you need to do is to implement the IMessageAwareService interface in your service. F.e.

[Service]
public class Service1 : Service, IMessageAwareService
{
	public IMessage Message { get; set; }
    ...

Then in the service method if you want to disable compression you may use code like

if ((this.Message != null) && (this.Message is BinMessage))
{
	(this.Message as BinMessage).UseCompression = false;
}

This change will affect only the message instance used to serve the current request. In other words if you disable compression in service method Foo and then call method Bar - in this second call compression will be enabled.

Regards

1 Like