coord-e / misskey-rs

:v: Client library for Misskey :smiling_face_with_three_hearts:
Apache License 2.0
59 stars 7 forks source link

Accept additional headers for WebSocketClient #64

Closed poppingmoon closed 1 year ago

poppingmoon commented 1 year ago

This PR allows users to add their custom headers to websocket requests. Added header method to WebSocketClientBuilder so that they can be specified in the same way as that of HttpClientBuilder.

coord-e commented 1 year ago

Also, please append this change to misskey-websocket/CHANGELOG.md.

poppingmoon commented 1 year ago

Can you give me a use case for this change? I've once tried to implement WebSocketClientBuilder::header but I stopped because I don't have use case for this.

At the time of commit, I could not connect to misskey.io with websocket. I found posts that say they have avoided the problem by changing User-Agent. https://misskey.io/notes/9cn5c6qje7 So I made this change and it worked as a workaround.

It seems that this problem on misskey.io was fixed by now, but I think it is good to provide the option for future usage.