Skip to content

Commit

Permalink
Merge pull request #405 from SteamRE/websocket
Browse files Browse the repository at this point in the history
Add websocket client support
  • Loading branch information
yaakov-h authored Jul 20, 2017
2 parents 5dca8c1 + 870d606 commit 8407eb6
Show file tree
Hide file tree
Showing 48 changed files with 1,458 additions and 1,012 deletions.
8 changes: 0 additions & 8 deletions Samples/1.Logon/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,6 @@ static void Main( string[] args )

static void OnConnected( SteamClient.ConnectedCallback callback )
{
if ( callback.Result != EResult.OK )
{
Console.WriteLine( "Unable to connect to Steam: {0}", callback.Result );

isRunning = false;
return;
}

Console.WriteLine( "Connected to Steam! Logging in '{0}'...", user );

steamUser.LogOn( new SteamUser.LogOnDetails
Expand Down
8 changes: 0 additions & 8 deletions Samples/2.Extending/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,6 @@ static void Main( string[] args )

static void OnConnected( SteamClient.ConnectedCallback callback )
{
if ( callback.Result != EResult.OK )
{
Console.WriteLine( "Unable to connect to Steam: {0}", callback.Result );

isRunning = false;
return;
}

Console.WriteLine( "Connected to Steam! Logging in '{0}'...", user );

steamUser.LogOn( new SteamUser.LogOnDetails
Expand Down
8 changes: 0 additions & 8 deletions Samples/3.DebugLog/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,6 @@ static void Main( string[] args )

static void OnConnected( SteamClient.ConnectedCallback callback )
{
if ( callback.Result != EResult.OK )
{
Console.WriteLine( "Unable to connect to Steam: {0}", callback.Result );

isRunning = false;
return;
}

Console.WriteLine( "Connected to Steam! Logging in '{0}'...", user );

steamUser.LogOn( new SteamUser.LogOnDetails
Expand Down
11 changes: 2 additions & 9 deletions Samples/4.Friends/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ static void Main( string[] args )
pass = args[ 1 ];

// create our steamclient instance
steamClient = new SteamClient( System.Net.Sockets.ProtocolType.Tcp );
var configuration = new SteamConfiguration { ProtocolTypes = ProtocolTypes.Tcp };
steamClient = new SteamClient( configuration );
// create the callback manager which will route callbacks to function calls
manager = new CallbackManager( steamClient );

Expand Down Expand Up @@ -78,14 +79,6 @@ static void Main( string[] args )

static void OnConnected( SteamClient.ConnectedCallback callback )
{
if ( callback.Result != EResult.OK )
{
Console.WriteLine( "Unable to connect to Steam: {0}", callback.Result );

isRunning = false;
return;
}

Console.WriteLine( "Connected to Steam! Logging in '{0}'...", user );

steamUser.LogOn( new SteamUser.LogOnDetails
Expand Down
8 changes: 0 additions & 8 deletions Samples/5.SteamGuard/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,6 @@ static void Main( string[] args )

static void OnConnected( SteamClient.ConnectedCallback callback )
{
if ( callback.Result != EResult.OK )
{
Console.WriteLine( "Unable to connect to Steam: {0}", callback.Result );

isRunning = false;
return;
}

Console.WriteLine( "Connected to Steam! Logging in '{0}'...", user );

byte[] sentryHash = null;
Expand Down
46 changes: 20 additions & 26 deletions Samples/7.ServerList/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,26 @@ static void Main( string[] args )
user = args[ 0 ];
pass = args[ 1 ];

var configuration = new SteamConfiguration();

var cellid = 0u;

// if we've previously connected and saved our cellid, load it.
if ( File.Exists( "cellid.txt" ) )
{
if ( !uint.TryParse( File.ReadAllText( "cellid.txt"), out cellid ) )
{
Console.WriteLine( "Error parsing cellid from cellid.txt. Continuing with cellid 0." );
}
else
{
Console.WriteLine( $"Using persisted cell ID {cellid}" );
configuration.CellID = cellid;
}
}

configuration.ServerListProvider = new FileStorageServerListProvider("servers_list.bin");

// create our steamclient instance
steamClient = new SteamClient();
// create the callback manager which will route callbacks to function calls
Expand All @@ -60,24 +80,6 @@ static void Main( string[] args )
steamUser.LogOff();
};

var cellid = 0u;

// if we've previously connected and saved our cellid, load it.
if ( File.Exists( "cellid.txt" ) )
{
if ( !uint.TryParse( File.ReadAllText( "cellid.txt"), out cellid ) )
{
Console.WriteLine( "Error parsing cellid from cellid.txt. Continuing with cellid 0." );
}
else
{
Console.WriteLine( $"Using persisted cell ID {cellid}" );
}
}

SteamClient.Servers.CellID = cellid;
SteamClient.Servers.ServerListProvider = new FileStorageServerListProvider("servers_list.bin");

isRunning = true;

Console.WriteLine( "Connecting to Steam..." );
Expand All @@ -95,14 +97,6 @@ static void Main( string[] args )

static void OnConnected( SteamClient.ConnectedCallback callback )
{
if ( callback.Result != EResult.OK )
{
Console.WriteLine( "Unable to connect to Steam: {0}", callback.Result );

isRunning = false;
return;
}

Console.WriteLine( "Connected to Steam! Logging in '{0}'...", user );

steamUser.LogOn( new SteamUser.LogOnDetails
Expand Down
8 changes: 0 additions & 8 deletions Samples/8.UnifiedMessages/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ static void Main( string[] args )

static void OnConnected( SteamClient.ConnectedCallback callback )
{
if ( callback.Result != EResult.OK )
{
Console.WriteLine( "Unable to connect to Steam: {0}", callback.Result );

isRunning = false;
return;
}

Console.WriteLine( "Connected to Steam! Logging in '{0}'...", user );

steamUser.LogOn( new SteamUser.LogOnDetails
Expand Down
8 changes: 0 additions & 8 deletions Samples/9.AsyncJobs/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,6 @@ static void Main( string[] args )

static void OnConnected( SteamClient.ConnectedCallback callback )
{
if ( callback.Result != EResult.OK )
{
Console.WriteLine( "Unable to connect to Steam: {0}", callback.Result );

isRunning = false;
return;
}

Console.WriteLine( "Connected to Steam! Logging in '{0}'...", user );

steamUser.LogOn( new SteamUser.LogOnDetails
Expand Down
189 changes: 0 additions & 189 deletions SteamKit2/SteamKit2/Networking/Steam3/Connection.cs

This file was deleted.

22 changes: 22 additions & 0 deletions SteamKit2/SteamKit2/Networking/Steam3/DisconnectedEventArgs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* This file is subject to the terms and conditions defined in
* file 'license.txt', which is part of this source code package.
*/



using System;

namespace SteamKit2
{
class DisconnectedEventArgs : EventArgs
{
public bool UserInitiated { get; }

public DisconnectedEventArgs( bool userInitiated )
{
this.UserInitiated = userInitiated;
}
}

}
Loading

0 comments on commit 8407eb6

Please sign in to comment.