Kaynağa Gözat

Cleaned Up WebSocketSharp Code

Frank van den Bos 1 yıl önce
ebeveyn
işleme
90b6daf7bc

+ 0 - 26
websocket-sharp-master/Example/AssemblyInfo.cs

@@ -1,26 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes. 
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle("Example")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("sta.blockhead")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion("1.0.*")]
-
-// The following attributes are used to specify the signing key for the assembly, 
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]

+ 0 - 65
websocket-sharp-master/Example/Example.csproj

@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{52805AEC-EFB1-4F42-BB8E-3ED4E692C568}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>Example</RootNamespace>
-    <AssemblyName>example</AssemblyName>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Ubuntu|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug_Ubuntu</OutputPath>
-    <DefineConstants>DEBUG</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Ubuntu|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Release_Ubuntu</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-  </ItemGroup>
-  <ItemGroup>
-    <ProjectReference Include="..\websocket-sharp\websocket-sharp.csproj">
-      <Project>{B357BAC7-529E-4D81-A0D2-71041B19C8DE}</Project>
-      <Name>websocket-sharp</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <ItemGroup>
-    <Compile Include="Program.cs" />
-    <Compile Include="AssemblyInfo.cs" />
-  </ItemGroup>
-</Project>

+ 0 - 117
websocket-sharp-master/Example/Program.cs

@@ -1,117 +0,0 @@
-using System;
-using System.Threading;
-using WebSocketSharp;
-using WebSocketSharp.Net;
-
-namespace Example
-{
-  public class Program
-  {
-    public static void Main (string[] args)
-    {
-      // Create a new instance of the WebSocket class.
-      //
-      // The WebSocket class inherits the System.IDisposable interface, so you can
-      // use the using statement. And the WebSocket connection will be closed with
-      // close status 1001 (going away) when the control leaves the using block.
-      //
-      // If you would like to connect to the server with the secure connection,
-      // you should create a new instance with a wss scheme WebSocket URL.
-
-      using (var ws = new WebSocket ("ws://localhost:4649/Echo"))
-      //using (var ws = new WebSocket ("wss://localhost:5963/Echo"))
-      //using (var ws = new WebSocket ("ws://localhost:4649/Chat"))
-      //using (var ws = new WebSocket ("wss://localhost:5963/Chat"))
-      //using (var ws = new WebSocket ("ws://localhost:4649/Chat?name=nobita"))
-      //using (var ws = new WebSocket ("wss://localhost:5963/Chat?name=nobita"))
-      {
-        // Set the WebSocket events.
-
-        ws.OnOpen += (sender, e) => ws.Send ("Hi, there!");
-
-        ws.OnMessage += (sender, e) => {
-            var fmt = "[WebSocket Message] {0}";
-            var body = !e.IsPing ? e.Data : "A ping was received.";
-
-            Console.WriteLine (fmt, body);
-          };
-
-        ws.OnError += (sender, e) => {
-            var fmt = "[WebSocket Error] {0}";
-
-            Console.WriteLine (fmt, e.Message);
-          };
-
-        ws.OnClose += (sender, e) => {
-            var fmt = "[WebSocket Close ({0})] {1}";
-
-            Console.WriteLine (fmt, e.Code, e.Reason);
-          };
-#if DEBUG
-        // To change the logging level.
-        ws.Log.Level = LogLevel.Trace;
-
-        // To change the wait time for the response to the Ping or Close.
-        //ws.WaitTime = TimeSpan.FromSeconds (10);
-
-        // To emit a WebSocket.OnMessage event when receives a ping.
-        //ws.EmitOnPing = true;
-#endif
-        // To enable the Per-message Compression extension.
-        //ws.Compression = CompressionMethod.Deflate;
-
-        // To validate the server certificate.
-        /*
-        ws.SslConfiguration.ServerCertificateValidationCallback =
-          (sender, certificate, chain, sslPolicyErrors) => {
-            var fmt = "Certificate:\n- Issuer: {0}\n- Subject: {1}";
-            var msg = String.Format (
-                        fmt, certificate.Issuer, certificate.Subject
-                      );
-
-            ws.Log.Debug (msg);
-
-            return true; // If the server certificate is valid.
-          };
-         */
-
-        // To send the credentials for the HTTP Authentication (Basic/Digest).
-        //ws.SetCredentials ("nobita", "password", false);
-
-        // To send the Origin header.
-        //ws.Origin = "http://localhost:4649";
-
-        // To send the cookies.
-        //ws.SetCookie (new Cookie ("name", "nobita"));
-        //ws.SetCookie (new Cookie ("roles", "\"idiot, gunfighter\""));
-
-        // To connect through the HTTP Proxy server.
-        //ws.SetProxy ("http://localhost:3128", "nobita", "password");
-
-        // To enable the redirection.
-        //ws.EnableRedirection = true;
-
-        // Connect to the server.
-        ws.Connect ();
-
-        // Connect to the server asynchronously.
-        //ws.ConnectAsync ();
-
-        Console.WriteLine ("\nType 'exit' to exit.\n");
-
-        while (true) {
-          Thread.Sleep (1000);
-          Console.Write ("> ");
-
-          var msg = Console.ReadLine ();
-
-          if (msg == "exit")
-            break;
-
-          // Send a text message.
-          ws.Send (msg);
-        }
-      }
-    }
-  }
-}

+ 0 - 7
websocket-sharp-master/Example2/App.config

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
-  <appSettings>
-    <add key="CertFilePassword" value="password"/>
-    <add key="ServerCertFile" value="/path/to/cert.pfx"/>
-  </appSettings>
-</configuration>

+ 0 - 26
websocket-sharp-master/Example2/AssemblyInfo.cs

@@ -1,26 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes. 
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle("Example2")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("sta.blockhead")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion("1.0.*")]
-
-// The following attributes are used to specify the signing key for the assembly, 
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]

+ 0 - 70
websocket-sharp-master/Example2/Chat.cs

@@ -1,70 +0,0 @@
-using System;
-using System.Threading;
-using WebSocketSharp;
-using WebSocketSharp.Server;
-
-namespace Example2
-{
-  public class Chat : WebSocketBehavior
-  {
-    private string     _name;
-    private static int _number = 0;
-    private string     _prefix;
-
-    public Chat ()
-    {
-      _prefix = "anon#";
-    }
-
-    public string Prefix {
-      get {
-        return _prefix;
-      }
-
-      set {
-        _prefix = !value.IsNullOrEmpty () ? value : "anon#";
-      }
-    }
-
-    private string getName ()
-    {
-      var name = QueryString["name"];
-
-      return !name.IsNullOrEmpty () ? name : _prefix + getNumber ();
-    }
-
-    private static int getNumber ()
-    {
-      return Interlocked.Increment (ref _number);
-    }
-
-    protected override void OnClose (CloseEventArgs e)
-    {
-      if (_name == null)
-        return;
-
-      var fmt = "{0} got logged off...";
-      var msg = String.Format (fmt, _name);
-
-      Sessions.Broadcast (msg);
-    }
-
-    protected override void OnMessage (MessageEventArgs e)
-    {
-      var fmt = "{0}: {1}";
-      var msg = String.Format (fmt, _name, e.Data);
-
-      Sessions.Broadcast (msg);
-    }
-
-    protected override void OnOpen ()
-    {
-      _name = getName ();
-
-      var fmt = "{0} has logged in!";
-      var msg = String.Format (fmt, _name);
-
-      Sessions.Broadcast (msg);
-    }
-  }
-}

+ 0 - 14
websocket-sharp-master/Example2/Echo.cs

@@ -1,14 +0,0 @@
-using System;
-using WebSocketSharp;
-using WebSocketSharp.Server;
-
-namespace Example2
-{
-  public class Echo : WebSocketBehavior
-  {
-    protected override void OnMessage (MessageEventArgs e)
-    {
-      Send (e.Data);
-    }
-  }
-}

+ 0 - 70
websocket-sharp-master/Example2/Example2.csproj

@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{B81A24C8-25BB-42B2-AF99-1E1EACCE74C7}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>Example2</RootNamespace>
-    <AssemblyName>example2</AssemblyName>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG;</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Ubuntu|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug_Ubuntu</OutputPath>
-    <DefineConstants>DEBUG;</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Ubuntu|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Release_Ubuntu</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Configuration" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="AssemblyInfo.cs" />
-    <Compile Include="Program.cs" />
-    <Compile Include="Echo.cs" />
-    <Compile Include="Chat.cs" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <ItemGroup>
-    <ProjectReference Include="..\websocket-sharp\websocket-sharp.csproj">
-      <Project>{B357BAC7-529E-4D81-A0D2-71041B19C8DE}</Project>
-      <Name>websocket-sharp</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="App.config" />
-  </ItemGroup>
-</Project>

+ 0 - 143
websocket-sharp-master/Example2/Program.cs

@@ -1,143 +0,0 @@
-using System;
-using System.Configuration;
-using System.Security.Cryptography.X509Certificates;
-using WebSocketSharp;
-using WebSocketSharp.Net;
-using WebSocketSharp.Server;
-
-namespace Example2
-{
-  public class Program
-  {
-    public static void Main (string[] args)
-    {
-      // Create a new instance of the WebSocketServer class.
-      //
-      // If you would like to provide the secure connection, you should
-      // create a new instance with the 'secure' parameter set to true or
-      // with a wss scheme WebSocket URL.
-
-      var wssv = new WebSocketServer (4649);
-      //var wssv = new WebSocketServer (5963, true);
-
-      //var wssv = new WebSocketServer (System.Net.IPAddress.Any, 4649);
-      //var wssv = new WebSocketServer (System.Net.IPAddress.Any, 5963, true);
-
-      //var wssv = new WebSocketServer (System.Net.IPAddress.IPv6Any, 4649);
-      //var wssv = new WebSocketServer (System.Net.IPAddress.IPv6Any, 5963, true);
-
-      //var wssv = new WebSocketServer ("ws://0.0.0.0:4649");
-      //var wssv = new WebSocketServer ("wss://0.0.0.0:5963");
-
-      //var wssv = new WebSocketServer ("ws://[::0]:4649");
-      //var wssv = new WebSocketServer ("wss://[::0]:5963");
-
-      //var wssv = new WebSocketServer (System.Net.IPAddress.Loopback, 4649);
-      //var wssv = new WebSocketServer (System.Net.IPAddress.Loopback, 5963, true);
-
-      //var wssv = new WebSocketServer (System.Net.IPAddress.IPv6Loopback, 4649);
-      //var wssv = new WebSocketServer (System.Net.IPAddress.IPv6Loopback, 5963, true);
-
-      //var wssv = new WebSocketServer ("ws://localhost:4649");
-      //var wssv = new WebSocketServer ("wss://localhost:5963");
-
-      //var wssv = new WebSocketServer ("ws://127.0.0.1:4649");
-      //var wssv = new WebSocketServer ("wss://127.0.0.1:5963");
-
-      //var wssv = new WebSocketServer ("ws://[::1]:4649");
-      //var wssv = new WebSocketServer ("wss://[::1]:5963");
-#if DEBUG
-      // To change the logging level.
-      wssv.Log.Level = LogLevel.Trace;
-
-      // To change the wait time for the response to the WebSocket Ping or Close.
-      //wssv.WaitTime = TimeSpan.FromSeconds (2);
-
-      // Not to remove the inactive sessions periodically.
-      //wssv.KeepClean = false;
-#endif
-      // To provide the secure connection.
-      /*
-      var cert = ConfigurationManager.AppSettings["ServerCertFile"];
-      var passwd = ConfigurationManager.AppSettings["CertFilePassword"];
-      wssv.SslConfiguration.ServerCertificate = new X509Certificate2 (cert, passwd);
-       */
-
-      // To provide the HTTP Authentication (Basic/Digest).
-      /*
-      wssv.AuthenticationSchemes = AuthenticationSchemes.Basic;
-      wssv.Realm = "WebSocket Test";
-      wssv.UserCredentialsFinder = id => {
-          var name = id.Name;
-
-          // Return user name, password, and roles.
-          return name == "nobita"
-                 ? new NetworkCredential (name, "password", "gunfighter")
-                 : null; // If the user credentials are not found.
-        };
-       */
-
-      // To resolve to wait for socket in TIME_WAIT state.
-      //wssv.ReuseAddress = true;
-
-      // Add the WebSocket services.
-      wssv.AddWebSocketService<Echo> ("/Echo");
-      wssv.AddWebSocketService<Chat> ("/Chat");
-
-      // Add the WebSocket service with initializing.
-      /*
-      wssv.AddWebSocketService<Chat> (
-        "/Chat",
-        s => {
-          s.Prefix = "Anon#";
-
-          // To send the Sec-WebSocket-Protocol header that has a subprotocol name.
-          s.Protocol = "chat";
-
-          // To ignore the Sec-WebSocket-Extensions header.
-          s.IgnoreExtensions = true;
-
-          // To emit a WebSocket.OnMessage event when receives a ping.
-          s.EmitOnPing = true;
-
-          // To validate the Origin header.
-          s.OriginValidator = val => {
-              // Check the value of the Origin header, and return true if valid.
-              Uri origin;
-
-              return !val.IsNullOrEmpty ()
-                     && Uri.TryCreate (val, UriKind.Absolute, out origin)
-                     && origin.Host == "localhost";
-            };
-
-          // To validate the cookies.
-          s.CookiesValidator = (req, res) => {
-              // Check the cookies in 'req', and set the cookies to send to
-              // the client with 'res' if necessary.
-              foreach (var cookie in req) {
-                cookie.Expired = true;
-                res.Add (cookie);
-              }
-
-              return true; // If valid.
-            };
-        }
-      );
-       */
-
-      wssv.Start ();
-
-      if (wssv.IsListening) {
-        Console.WriteLine ("Listening on port {0}, and providing WebSocket services:", wssv.Port);
-
-        foreach (var path in wssv.WebSocketServices.Paths)
-          Console.WriteLine ("- {0}", path);
-      }
-
-      Console.WriteLine ("\nPress Enter key to stop the server...");
-      Console.ReadLine ();
-
-      wssv.Stop ();
-    }
-  }
-}

+ 0 - 8
websocket-sharp-master/Example3/App.config

@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<configuration>
-  <appSettings>
-    <add key="CertFilePassword" value="password"/>
-    <add key="DocumentRootPath" value="../../Public"/>
-    <add key="ServerCertFile" value="/path/to/cert.pfx"/>
-  </appSettings>
-</configuration>

+ 0 - 26
websocket-sharp-master/Example3/AssemblyInfo.cs

@@ -1,26 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes. 
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle("Example3")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("sta.blockhead")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion("1.0.*")]
-
-// The following attributes are used to specify the signing key for the assembly, 
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]

+ 0 - 70
websocket-sharp-master/Example3/Chat.cs

@@ -1,70 +0,0 @@
-using System;
-using System.Threading;
-using WebSocketSharp;
-using WebSocketSharp.Server;
-
-namespace Example3
-{
-  public class Chat : WebSocketBehavior
-  {
-    private string     _name;
-    private static int _number = 0;
-    private string     _prefix;
-
-    public Chat ()
-    {
-      _prefix = "anon#";
-    }
-
-    public string Prefix {
-      get {
-        return _prefix;
-      }
-
-      set {
-        _prefix = !value.IsNullOrEmpty () ? value : "anon#";
-      }
-    }
-
-    private string getName ()
-    {
-      var name = QueryString["name"];
-
-      return !name.IsNullOrEmpty () ? name : _prefix + getNumber ();
-    }
-
-    private static int getNumber ()
-    {
-      return Interlocked.Increment (ref _number);
-    }
-
-    protected override void OnClose (CloseEventArgs e)
-    {
-      if (_name == null)
-        return;
-
-      var fmt = "{0} got logged off...";
-      var msg = String.Format (fmt, _name);
-
-      Sessions.Broadcast (msg);
-    }
-
-    protected override void OnMessage (MessageEventArgs e)
-    {
-      var fmt = "{0}: {1}";
-      var msg = String.Format (fmt, _name, e.Data);
-
-      Sessions.Broadcast (msg);
-    }
-
-    protected override void OnOpen ()
-    {
-      _name = getName ();
-
-      var fmt = "{0} has logged in!";
-      var msg = String.Format (fmt, _name);
-
-      Sessions.Broadcast (msg);
-    }
-  }
-}

+ 0 - 14
websocket-sharp-master/Example3/Echo.cs

@@ -1,14 +0,0 @@
-using System;
-using WebSocketSharp;
-using WebSocketSharp.Server;
-
-namespace Example3
-{
-  public class Echo : WebSocketBehavior
-  {
-    protected override void OnMessage (MessageEventArgs e)
-    {
-      Send (e.Data);
-    }
-  }
-}

+ 0 - 76
websocket-sharp-master/Example3/Example3.csproj

@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{C648BA25-77E5-4A40-A97F-D0AA37B9FB26}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>Example3</RootNamespace>
-    <AssemblyName>example3</AssemblyName>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG;</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Ubuntu|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug_Ubuntu</OutputPath>
-    <DefineConstants>DEBUG;</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Ubuntu|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Release_Ubuntu</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Configuration" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="AssemblyInfo.cs" />
-    <Compile Include="Program.cs" />
-    <Compile Include="Chat.cs" />
-    <Compile Include="Echo.cs" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <ItemGroup>
-    <ProjectReference Include="..\websocket-sharp\websocket-sharp.csproj">
-      <Project>{B357BAC7-529E-4D81-A0D2-71041B19C8DE}</Project>
-      <Name>websocket-sharp</Name>
-    </ProjectReference>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="App.config" />
-    <None Include="Public\index.html" />
-    <None Include="Public\Js\echotest.js" />
-  </ItemGroup>
-  <ItemGroup>
-    <Folder Include="Public\" />
-    <Folder Include="Public\Js\" />
-  </ItemGroup>
-</Project>

+ 0 - 179
websocket-sharp-master/Example3/Program.cs

@@ -1,179 +0,0 @@
-using System;
-using System.Configuration;
-using System.Security.Cryptography.X509Certificates;
-using System.Text;
-using WebSocketSharp;
-using WebSocketSharp.Net;
-using WebSocketSharp.Server;
-
-namespace Example3
-{
-  public class Program
-  {
-    public static void Main (string[] args)
-    {
-      // Create a new instance of the HttpServer class.
-      //
-      // If you would like to provide the secure connection, you should
-      // create a new instance with the 'secure' parameter set to true or
-      // with an https scheme HTTP URL.
-
-      var httpsv = new HttpServer (4649);
-      //var httpsv = new HttpServer (5963, true);
-
-      //var httpsv = new HttpServer (System.Net.IPAddress.Any, 4649);
-      //var httpsv = new HttpServer (System.Net.IPAddress.Any, 5963, true);
-
-      //var httpsv = new HttpServer (System.Net.IPAddress.IPv6Any, 4649);
-      //var httpsv = new HttpServer (System.Net.IPAddress.IPv6Any, 5963, true);
-
-      //var httpsv = new HttpServer ("http://0.0.0.0:4649");
-      //var httpsv = new HttpServer ("https://0.0.0.0:5963");
-
-      //var httpsv = new HttpServer ("http://[::0]:4649");
-      //var httpsv = new HttpServer ("https://[::0]:5963");
-
-      //var httpsv = new HttpServer (System.Net.IPAddress.Loopback, 4649);
-      //var httpsv = new HttpServer (System.Net.IPAddress.Loopback, 5963, true);
-
-      //var httpsv = new HttpServer (System.Net.IPAddress.IPv6Loopback, 4649);
-      //var httpsv = new HttpServer (System.Net.IPAddress.IPv6Loopback, 5963, true);
-
-      //var httpsv = new HttpServer ("http://localhost:4649");
-      //var httpsv = new HttpServer ("https://localhost:5963");
-
-      //var httpsv = new HttpServer ("http://127.0.0.1:4649");
-      //var httpsv = new HttpServer ("https://127.0.0.1:5963");
-
-      //var httpsv = new HttpServer ("http://[::1]:4649");
-      //var httpsv = new HttpServer ("https://[::1]:5963");
-#if DEBUG
-      // To change the logging level.
-      httpsv.Log.Level = LogLevel.Trace;
-
-      // To change the wait time for the response to the WebSocket Ping or Close.
-      //httpsv.WaitTime = TimeSpan.FromSeconds (2);
-
-      // Not to remove the inactive WebSocket sessions periodically.
-      //httpsv.KeepClean = false;
-#endif
-      // To provide the secure connection.
-      /*
-      var cert = ConfigurationManager.AppSettings["ServerCertFile"];
-      var passwd = ConfigurationManager.AppSettings["CertFilePassword"];
-      httpsv.SslConfiguration.ServerCertificate = new X509Certificate2 (cert, passwd);
-       */
-
-      // To provide the HTTP Authentication (Basic/Digest).
-      /*
-      httpsv.AuthenticationSchemes = AuthenticationSchemes.Basic;
-      httpsv.Realm = "WebSocket Test";
-      httpsv.UserCredentialsFinder = id => {
-          var name = id.Name;
-
-          // Return user name, password, and roles.
-          return name == "nobita"
-                 ? new NetworkCredential (name, "password", "gunfighter")
-                 : null; // If the user credentials are not found.
-        };
-       */
-
-      // To resolve to wait for socket in TIME_WAIT state.
-      //httpsv.ReuseAddress = true;
-
-      // Set the document root path.
-      httpsv.DocumentRootPath = ConfigurationManager.AppSettings["DocumentRootPath"];
-
-      // Set the HTTP GET request event.
-      httpsv.OnGet += (sender, e) => {
-          var req = e.Request;
-          var res = e.Response;
-
-          var path = req.RawUrl;
-
-          if (path == "/")
-            path += "index.html";
-
-          byte[] contents;
-
-          if (!e.TryReadFile (path, out contents)) {
-            res.StatusCode = (int) HttpStatusCode.NotFound;
-
-            return;
-          }
-
-          if (path.EndsWith (".html")) {
-            res.ContentType = "text/html";
-            res.ContentEncoding = Encoding.UTF8;
-          }
-          else if (path.EndsWith (".js")) {
-            res.ContentType = "application/javascript";
-            res.ContentEncoding = Encoding.UTF8;
-          }
-
-          res.ContentLength64 = contents.LongLength;
-
-          res.Close (contents, true);
-        };
-
-      // Add the WebSocket services.
-      httpsv.AddWebSocketService<Echo> ("/Echo");
-      httpsv.AddWebSocketService<Chat> ("/Chat");
-
-      // Add the WebSocket service with initializing.
-      /*
-      httpsv.AddWebSocketService<Chat> (
-        "/Chat",
-        s => {
-          s.Prefix = "Anon#";
-
-          // To send the Sec-WebSocket-Protocol header that has a subprotocol name.
-          s.Protocol = "chat";
-
-          // To ignore the Sec-WebSocket-Extensions header.
-          s.IgnoreExtensions = true;
-
-          // To emit a WebSocket.OnMessage event when receives a ping.
-          s.EmitOnPing = true;
-
-          // To validate the Origin header.
-          s.OriginValidator = val => {
-              // Check the value of the Origin header, and return true if valid.
-              Uri origin;
-
-              return !val.IsNullOrEmpty ()
-                     && Uri.TryCreate (val, UriKind.Absolute, out origin)
-                     && origin.Host == "localhost";
-            };
-
-          // To validate the cookies.
-          s.CookiesValidator = (req, res) => {
-              // Check the cookies in 'req', and set the cookies to send to
-              // the client with 'res' if necessary.
-              foreach (var cookie in req) {
-                cookie.Expired = true;
-                res.Add (cookie);
-              }
-
-              return true; // If valid.
-            };
-        }
-      );
-       */
-
-      httpsv.Start ();
-
-      if (httpsv.IsListening) {
-        Console.WriteLine ("Listening on port {0}, and providing WebSocket services:", httpsv.Port);
-
-        foreach (var path in httpsv.WebSocketServices.Paths)
-          Console.WriteLine ("- {0}", path);
-      }
-
-      Console.WriteLine ("\nPress Enter key to stop the server...");
-      Console.ReadLine ();
-
-      httpsv.Stop ();
-    }
-  }
-}

+ 0 - 68
websocket-sharp-master/Example3/Public/Js/echotest.js

@@ -1,68 +0,0 @@
-/*
- * echotest.js
- *
- * Derived from Echo Test of WebSocket.org (http://www.websocket.org/echo.html).
- *
- * Copyright (c) 2012 Kaazing Corporation.
- */
-
-var url = "ws://localhost:4649/Echo";
-//var url = "wss://localhost:5963/Echo";
-var output;
-
-function init () {
-  output = document.getElementById ("output");
-  doWebSocket ();
-}
-
-function doWebSocket () {
-  websocket = new WebSocket (url);
-
-  websocket.onopen = function (e) {
-    onOpen (e);
-  };
-
-  websocket.onmessage = function (e) {
-    onMessage (e);
-  };
-
-  websocket.onerror = function (e) {
-    onError (e);
-  };
-
-  websocket.onclose = function (e) {
-    onClose (e);
-  };
-}
-
-function onOpen (event) {
-  writeToScreen ("CONNECTED");
-  send ("WebSocket rocks");
-}
-
-function onMessage (event) {
-  writeToScreen ('<span style="color: blue;">RESPONSE: ' + event.data + '</span>');
-  websocket.close ();
-}
-
-function onError (event) {
-  writeToScreen ('<span style="color: red;">ERROR: ' + event.data + '</span>');
-}
-
-function onClose (event) {
-  writeToScreen ("DISCONNECTED");
-}
-
-function send (message) {
-  writeToScreen ("SENT: " + message);
-  websocket.send (message);
-}
-
-function writeToScreen (message) {
-  var pre = document.createElement ("p");
-  pre.style.wordWrap = "break-word";
-  pre.innerHTML = message;
-  output.appendChild (pre);
-}
-
-window.addEventListener ("load", init, false);

+ 0 - 12
websocket-sharp-master/Example3/Public/index.html

@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>WebSocket Echo Test</title>
-    <script type="text/javascript" src="/Js/echotest.js">
-    </script>
-  </head>
-  <body>
-    <h2>WebSocket Echo Test</h2>
-    <div id="output"></div>
-  </body>
-</html>

+ 0 - 4
websocket-sharp-master/websocket-sharp/doc/.gitignore

@@ -1,4 +0,0 @@
-## Ignore MonoDevelop build results.
-
-html
-mdoc

+ 0 - 31
websocket-sharp-master/websocket-sharp/doc/doc.sh

@@ -1,31 +0,0 @@
-#!/bin/sh
-#
-# @(#) doc.sh ver.0.0.2 2013.01.24
-#
-# Usage:
-#   doc.sh
-#
-# Description:
-#   Creating documentation for websocket-sharp.
-#
-###########################################################################
-
-SRC_DIR="../bin/Release_Ubuntu"
-XML="${SRC_DIR}/websocket-sharp.xml"
-DLL="${SRC_DIR}/websocket-sharp.dll"
-
-DOC_DIR="."
-MDOC_DIR="${DOC_DIR}/mdoc"
-HTML_DIR="${DOC_DIR}/html"
-
-createDir() {
-  if [ ! -d $1 ]; then
-    mkdir -p $1
-  fi
-}
-
-set -e
-createDir ${MDOC_DIR}
-createDir ${HTML_DIR}
-mdoc update --delete -fno-assembly-versions -i ${XML} -o ${MDOC_DIR}/ ${DLL}
-mdoc export-html -o ${HTML_DIR}/ ${MDOC_DIR}/

+ 0 - 64
websocket-sharp-master/websocket-sharp/websocket-sharp.csproj

@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{B357BAC7-529E-4D81-A0D2-71041B19C8DE}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <RootNamespace>WebSocketSharp</RootNamespace>
-    <AssemblyName>websocket-sharp</AssemblyName>
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
-    <SignAssembly>true</SignAssembly>
-    <AssemblyOriginatorKeyFile>websocket-sharp.snk</AssemblyOriginatorKeyFile>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>false</ConsolePause>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>false</ConsolePause>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug_Ubuntu|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug_Ubuntu</OutputPath>
-    <DefineConstants>DEBUG</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>false</ConsolePause>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_Ubuntu|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Release_Ubuntu</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <ConsolePause>false</ConsolePause>
-    <GenerateDocumentation>true</GenerateDocumentation>
-    <CustomCommands>
-      <CustomCommands>
-        <Command type="AfterBuild" command="doc/doc.sh" workingdir="doc/" externalConsole="True" />
-      </CustomCommands>
-    </CustomCommands>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.ServiceModel" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-</Project>

BIN
websocket-sharp-master/websocket-sharp/websocket-sharp.snk