devoxin / SharpLink

Lavalink wrapper for Discord.Net written in C#
MIT License
27 stars 6 forks source link

WebSocket fails on .NETFramework #11

Open NovusTheory opened 6 years ago

NovusTheory commented 6 years ago

As per how ClientWebSocket works in .NETFramework (Microsoft's problem) the WebSocket fails to connect properly or at least will throw an exception saying the "Connection" header is invalid because Lavalink is sending Upgrade,Keep-Alive and Microsoft programmed it to only allow a connection header equal to Upgrade.

Workaround / Likely only fix => Create custom WebSocket class. EDIT: WebSocket4Net usage works too

xXBuilderBXx commented 6 years ago

This also seems to fix the issue its a modified websocket based on the original websocket class so all you have to do it replace clientwebsocket with this class and it works. https://github.com/PingmanTools/System.Net.WebSockets.Client.Managed

NovusTheory commented 6 years ago

Thank you for that @xXBuilderBXx. I will look into this!