Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling compression? #562

Closed
AdamFrisby opened this issue Oct 28, 2022 · 4 comments
Closed

Enabling compression? #562

AdamFrisby opened this issue Oct 28, 2022 · 4 comments

Comments

@AdamFrisby
Copy link

Hi - any pointers on where to enable MessagePack compression in MagicOnion?

The serializerOptions: MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray) in the client-side requests to StreamingHubClient.ConnectAsync makes sense, but I presume this needs to be enabled in the server somehow as well?

Thankyou! (great library btw)

@mwegner
Copy link

mwegner commented Oct 28, 2022

We do this server-side, which I think is right?

builder.Services.Configure<MagicOnionOptions>(options =>
{
	// messagepack options for magiconion-managed serialization
	options.SerializerOptions = MessagePackSerializerOptions.Standard
		.WithCompression(MessagePackCompression.Lz4BlockArray)
		.WithResolver(MessagePackX.GetResolver());

	options.IsReturnExceptionStackTraceInErrorDetail = true;
});

(That MessagePackX is an extension class that returns our resolver--could skip that or plug in your resolvers there)

@AdamFrisby
Copy link
Author

Thankyou - that looks right!

@AdamFrisby
Copy link
Author

AdamFrisby commented Dec 12, 2024

Alas, I need to re-open this as the method has changed, I've tried a few variations, but they're no longer working. Does anyone know the current correct method for this?

@AdamFrisby AdamFrisby reopened this Dec 12, 2024
@AdamFrisby
Copy link
Author

And this is what is needed now.

MagicOnionSerializerProvider.Default =
MessagePackMagicOnionSerializerProvider.Default.WithOptions(MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants