question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change message protocol with Azure Management SDK

See original GitHub issue

Hi,

I have a question regarding Microsoft.Azure.SignalR.Management package.

Is there a way to change the protocol (MessagePack, NewtonSoftJson, Protobuf, …) ? (like with a ‘classic’ SignalR client)

After reading the code, it seems that, when we create a HubContext with CreateHubContextAsync there is a hardcoded AddSignalRCore() so we cannot add protocol options.

https://github.com/Azure/azure-signalr/blob/6faf565144c0bacc31d001cda3c2ca3dbc78602b/src/Microsoft.Azure.SignalR.Management/ServiceManager.cs#L55

Is there a way change the default serialisation protocol when using SignalR Management SDK ? If no, do you plan to add it as a new feature ? Do you want a PR to be able to add options to SignalR Management ?

Thanks !

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
arek-avanadecommented, Oct 12, 2020

@dmitrykarnitski As a workaround you could set a global default serializer settings for Newtonsoft.JSON in your startup file:

            JsonConvert.DefaultSettings = () => new JsonSerializerSettings
            {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            };
1reaction
wanlwanlcommented, Sep 20, 2019

The management sdk always use MessagePack to send messages, the signalr service will convert to the correct protocal (only support json/messagepack) to the signalr client. So the only thing you need to care about is the signalr client’s protocol. For example, you can try to use MessagePack in signlar client

// message pack
var connection = new HubConnectionBuilder().WithUrl(url).AddMessagePackProtocol().Build();
// json
var connection = new HubConnectionBuilder().WithUrl(url).Build();

and use a management sdk to send message, you will see both can receive messages.

For other protocols, I think add a ProtocolProvider to management sdk is fine. When use protocols other than json/messagepack, the sianglr service will not recoginize special messages like close messages. But management sdk doesn’t design to support it, so its ok to simply add a ProtocolProvider in management sdk.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SDKs and REST APIs for Azure Communication Services
Learn more about Azure Communication Services SDKs and REST APIs. ... Azure Resource Manager, REST, Service, Provision and manage ...
Read more >
Azure REST API reference documentation
Reference documentation for Azure REST APIs including their supported operations, request URI parameters and request bodies, responses, ...
Read more >
Publish messages using Azure Web PubSub service SDK
Set up the project to publish messages · Open a new command shell for this project. · Save the connection string from the...
Read more >
Best practices for improving performance using Azure ...
This article describes how to use Azure Service Bus to optimize performance when exchanging brokered messages. The first part of this ...
Read more >
Azure IoT Hub communication protocols and ports
This article describes the supported communication protocols for device-to-cloud and cloud-to-device communications and the port numbers ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found