MQTTnet icon indicating copy to clipboard operation
MQTTnet copied to clipboard

Custom websocket request headers

Open cquesnel opened this issue 7 years ago • 1 comments

Hi,

I was wondering if there was a reason for which the requestHeaders for a websocket connection are not configurable through the options builder. From what I see all the code is there, and would only require an overload to WithWebSocketServer in MqttClientOptionsBuilder such as :

public MqttClientOptionsBuilder WithWebSocketServer(string uri, IDictionary<string, string> requestHeaders)
{
    _webSocketOptions = new MqttClientWebSocketOptions
    {
        Uri = uri,
        RequestHeaders = requestHeaders
    };

    return this;
}

I was asking because when using an AWS custom authorizer for validating connections, it needs some information passed through headers.

I can fork and start a pull request if you wish.

Thanks for your help, Charles

cquesnel avatar Dec 13 '18 16:12 cquesnel

Hi, yes please create a pull request. Please take care for backward compatibility when adding parameters to functions of the options builder.

This was not added because no one ever asked for it 😄

Best regards Christian

chkr1011 avatar Dec 13 '18 16:12 chkr1011