Marfusios/websocket-client

Allow to set RequestHeader

traderqq opened this issue · 2 comments

Hi

Would be nice to have ability to call SetRequestHeader on underlying ClientWebSocket object.

I tried two approaches, using Func<> delegate and using NativeClient.

Func<> indeed allows to set properties like KeepAliveInterval, but SetRequestHeader is a method and I can't call it inside delegate init.

With NativeClient, it is null before you call Run and you can't do anything with it,
but after you started websockets with Run, NativeClient is not null but you can't send headers anymore because web socket is already started.

I tried with Run => Stop => set header (as NativeClient is not null) => Run, but got same error that websocket already started.

Cool, did not knew that way, may be worth adding to the docs.
Thanks for the great lib!