Skip to content

Commit

Permalink
🔌 Drop custom headers, use query URL for websocket
Browse files Browse the repository at this point in the history
  • Loading branch information
molenzwiebel committed Aug 1, 2019
1 parent b7f42c9 commit 4fae346
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
5 changes: 3 additions & 2 deletions conduit/Conduit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
Expand All @@ -86,8 +87,8 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="websocket-sharp-customheaders, Version=1.0.2.31869, Culture=neutral, PublicKeyToken=5660b08a1845a91e, processorArchitecture=MSIL">
<HintPath>packages\websocket-sharp-customheaders.1.0.2.31869\lib\net35\websocket-sharp-customheaders.dll</HintPath>
<Reference Include="websocket-sharp, Version=1.0.2.59611, Culture=neutral, PublicKeyToken=5660b08a1845a91e, processorArchitecture=MSIL">
<HintPath>packages\WebSocketSharp.1.0.3-rc11\lib\websocket-sharp.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
Expand Down
13 changes: 7 additions & 6 deletions conduit/HubConnectionHandler.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Web;
using WebSocketSharp;

namespace Conduit
Expand All @@ -23,12 +24,12 @@ public HubConnectionHandler(LeagueConnection league)
{
this.league = league;

socket = new WebSocket(Program.HUB_WS);
socket.CustomHeaders = new Dictionary<string, string>()
{
{"Token", Persistence.GetHubToken()},
{"Public-Key", CryptoHelpers.ExportPublicKey()}
};
// Pass parameters in the URL.
socket = new WebSocket(
Program.HUB_WS
+ "?token=" + HttpUtility.UrlEncode(Persistence.GetHubToken())
+ "&publicKey=" + HttpUtility.UrlEncode(CryptoHelpers.ExportPublicKey())
);

socket.OnMessage += HandleMessage;
socket.OnClose += (sender, ev) =>
Expand Down
3 changes: 1 addition & 2 deletions conduit/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System;
using System.IO;

namespace Conduit
{
class Program
{
public static string APP_NAME = "Mimic Conduit";
public static string VERSION = "2.1.0";
public static string VERSION = "2.2.0";

public static string HUB_WS = "wss://rift.mimic.lol/conduit";
public static string HUB = "https://rift.mimic.lol";
Expand Down
2 changes: 1 addition & 1 deletion conduit/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
<package id="websocket-sharp-customheaders" version="1.0.2.31869" targetFramework="net461" />
<package id="WebSocketSharp" version="1.0.3-rc11" targetFramework="net461" />
</packages>

0 comments on commit 4fae346

Please sign in to comment.