Added NightAlert project for travel kit

This commit is contained in:
2021-06-10 14:39:06 -04:00
commit d38d9e3b7e
308 changed files with 35922 additions and 0 deletions

View File

@@ -0,0 +1,308 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Typescript v1 declaration files
typings/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
EngineIoClientDotNet_Tests/Resources/test.xml
TestServer/test.xml
Working/

View File

@@ -0,0 +1,79 @@
# Socket.IO .NET
Socket.IO enables real-time bidirectional event-based communication.
It works on every platform, browser or device, focusing equally on reliability and speed.
* **Real-time analytics**
Push data to clients that gets represented as real-time counters, charts or logs.
* **Instant messaging and chat**
Socket.IO's "Hello world" is a chat app in just a few lines of code.
* **Binary streaming**
Starting in 1.0, it's possible to send any blob back and forth: image, audio, video.
* **Document collaboration**
Allow users to concurrently edit a document and see each other's changes.
> **USED BY EVERYONE**
> From Microsoft Office, Yammer, Zendesk, Trello... to hackathon winners and little startups.
> **IMMENSELY POWERFUL, YET EASY TO USE**
> Our getting started guide will show you how to create lots of amazing applications in fewer
> than 200 lines of code.
## Connect to Server
Connecting to a Socket.IO server is just two lines:
// connect to a Socket.IO server
socket = IO.Socket("http://chat.socket.io/");
socket.Connect();
// disconnect from the server
socket.Close();
## Subscribe to Events
Listening for messages from the server is easy,all we need to do is
attach a delegate to the event name using the `On` method.
The `data` received from the http://chat.socket.io/ server is a `JToken` value:
// whenever the server emits "login", print the login message
socket.On("login", data => {
connected = true;
// get the json data from the server message
var jobject = data as JToken;
// get the number of users
var numUsers = jobject.Value<int>("numUsers");
// display the welcome message...
});
// whenever the server emits "new message", update the chat body
socket.On("new message", data => {
// get the json data from the server message
var jobject = data as JToken;
// get the message data values
var username = jobject.Value<string>("username");
var message = jobject.Value<string>("message");
// display message...
});
## Send a Message
Sending a message to the server is just a single line of code that makes use of the
`Emit` method:
// we can send messages to the server
socket.Emit("add user", "username");
if (connected) {
socket.Emit("new message", "This is a message from Xamarin.Android...");
}
// or we can just send events
socket.Emit("typing");
// cancel that typing event
socket.Emit("stop typing");

View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Quobject
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,49 @@
# SocketIoClientDotNet
====================
Socket.IO Client Library for .Net
* NuGet Package: [![SocketIoClientDotNet](https://img.shields.io/nuget/v/SocketIoClientDotNet.svg?maxAge=2592000)](https://www.nuget.org/packages/SocketIoClientDotNet/)
This is the Socket.IO Client Library for C#, which is ported from the [JavaScript client](https://github.com/Automattic/socket.io-client) version [1.1.0](https://github.com/socketio/socket.io-client/releases/tag/1.1.0).
See also: [EngineIoClientDotNet](https://github.com/Quobject/EngineIoClientDotNet)
## Installation
[Nuget install](https://www.nuget.org/packages/SocketIoClientDotNet/):
```
Install-Package SocketIoClientDotNet
```
## Usage
SocketIoClientDotNet has a similar api to those of the [JavaScript client](https://github.com/Automattic/socket.io-client).
```cs
using Quobject.SocketIoClientDotNet.Client;
var socket = IO.Socket("http://localhost");
socket.On(Socket.EVENT_CONNECT, () =>
{
socket.Emit("hi");
});
socket.On("hi", (data) =>
{
Console.WriteLine(data);
socket.Disconnect();
});
Console.ReadLine();
```
More examples can be found in [unit tests](https://github.com/Quobject/SocketIoClientDotNet/blob/master/Src/SocketIoClientDotNet.Tests.net45/ClientTests/ServerConnectionTest.cs) acting against the [test server](https://github.com/Quobject/SocketIoClientDotNet/blob/master/TestServer/server.js).
## Features
This library supports all of the features the JS client does, including events, options and upgrading transport.
## Framework Versions
.NETFramework v3.5, .NETFramework v4.0, .NETFramework v4.4, .NETStandard v1.3,
## License
[MIT](http://opensource.org/licenses/MIT)

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SocketIoClientDotNet.Tests.mono")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SocketIoClientDotNet.Tests.mono")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0df2fc9c-4abf-4925-9617-c374461b8ea7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\SocketIoClientDotNet.mono\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\SocketIoClientDotNet.mono\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{022DE7B5-7AA6-447A-8720-DDF627C384FD}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SocketIoClientDotNet.Tests.mono</RootNamespace>
<AssemblyName>SocketIoClientDotNet.Tests.mono</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>56483a1c</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EngineIoClientDotNet, Version=0.9.18.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.mono\packages\EngineIoClientDotNet.0.9.18\lib\net45\EngineIoClientDotNet.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.mono\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WebSocket4Net, Version=0.12.0.0, Culture=neutral, PublicKeyToken=eb4e154b696bf72a, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.mono\packages\WebSocket4Net.0.12\lib\net45\WebSocket4Net.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.mono\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.assert, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.mono\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.core, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.mono\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\Connection.cs">
<Link>ClientTests\Connection.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\ServerConnectionTest.cs">
<Link>ClientTests\ServerConnectionTest.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\UrlTest.cs">
<Link>ClientTests\UrlTest.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ModuleTests\HasBinaryDataTest.cs">
<Link>ModuleTests\HasBinaryDataTest.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\ByteArrayTest.cs">
<Link>ParserTests\ByteArrayTest.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\Helpers.cs">
<Link>ParserTests\Helpers.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\ParserTest.cs">
<Link>ParserTests\ParserTest.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SocketIoClientDotNet.mono\SocketIoClientDotNet.mono.csproj">
<Project>{9c663463-8a1d-4960-a64a-1e0303034fe2}</Project>
<Name>SocketIoClientDotNet.mono</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\SocketIoClientDotNet.mono\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\SocketIoClientDotNet.mono\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebSocket4Net" publicKeyToken="eb4e154b696bf72a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.12.0.0" newVersion="0.12.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EngineIoClientDotNet" version="0.9.18" targetFramework="net45" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="WebSocket4Net" version="0.12" targetFramework="net45" />
<package id="xunit" version="2.0.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
</packages>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SocketIoClientDotNet.Tests.net35")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SocketIoClientDotNet.Tests.net35")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("bf93a8d2-2707-4a53-93d6-a6a00af2f1d5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6D90EB17-A71E-4A5F-8BF1-1F7991AEB976}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SocketIoClientDotNet.Tests</RootNamespace>
<AssemblyName>SocketIoClientDotNet.Tests.net35</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EngineIoClientDotNet, Version=1.0.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net35\packages\EngineIoClientDotNet.1.0.4\lib\net35\EngineIoClientDotNet.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net35\packages\Newtonsoft.Json.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SuperSocket.ClientEngine, Version=0.9.0.0, Culture=neutral, PublicKeyToken=ee9af13f57f00acc, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net35\packages\SuperSocket.ClientEngine.Core.0.9.0\lib\net35-client\SuperSocket.ClientEngine.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Threading.Tasks.NET35, Version=3.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\SocketIoClientDotNet.net35\packages\System.Threading.Tasks.Unofficial.3.1\lib\net35\System.Threading.Tasks.NET35.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WebSocket4Net, Version=0.15.1.10, Culture=neutral, PublicKeyToken=eb4e154b696bf72a, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net35\packages\WebSocket4Net.0.15.1\lib\net35\WebSocket4Net.dll</HintPath>
</Reference>
<Reference Include="xunit, Version=1.9.2.1705, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net35\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\Connection.cs">
<Link>ClientTests\Connection.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\ConnectionConstants.cs">
<Link>ClientTests\ConnectionConstants.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\ServerConnectionTest_net35.cs">
<Link>ClientTests\ServerConnectionTest_net35.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\UrlTest.cs">
<Link>ClientTests\UrlTest.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ModuleTests\HasBinaryDataTest.cs">
<Link>ModuleTests\HasBinaryDataTest.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\ByteArrayTest.cs">
<Link>ParserTests\ByteArrayTest.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\Helpers.cs">
<Link>ParserTests\Helpers.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\ParserTest.cs">
<Link>ParserTests\ParserTest.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SocketIoClientDotNet.net35\SocketIoClientDotNet.net35.csproj">
<Project>{e3d3a67d-9a1e-4915-8a2d-1c0e4447f5e0}</Project>
<Name>SocketIoClientDotNet.net35</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,20 @@
<ProjectConfiguration>
<Settings>
<IgnoredTests>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ParserTests.ParserTest</FixtureName>
</FixtureTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ParserTests.ByteArrayTest</FixtureName>
</FixtureTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ModuleTests.HasBinaryDataTest</FixtureName>
</FixtureTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ClientTests.UrlTest</FixtureName>
</FixtureTestSelector>
<AllTestsSelector />
</IgnoredTests>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebSocket4Net" publicKeyToken="eb4e154b696bf72a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.12.0.0" newVersion="0.12.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SuperSocket.ClientEngine" publicKeyToken="ee9af13f57f00acc" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.8.0.12" newVersion="0.8.0.12" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EngineIoClientDotNet" version="1.0.4" targetFramework="net35" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net35" />
<package id="SuperSocket.ClientEngine.Core" version="0.9.0" targetFramework="net35" />
<package id="System.Threading.Tasks.Unofficial" version="3.1" targetFramework="net35" />
<package id="WebSocket4Net" version="0.15.1" targetFramework="net35" />
<package id="xunit" version="1.9.2" targetFramework="net35" />
</packages>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SocketIoClientDotNet.Tests.net40")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SocketIoClientDotNet.Tests.net40")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("b7bc8677-efa2-47e2-86c3-1ab3f31238c3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DD1A4F5E-5606-4989-9DF8-C1BBD50CD850}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SocketIoClientDotNet.Tests.net40</RootNamespace>
<AssemblyName>SocketIoClientDotNet.Tests.net40</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="EngineIoClientDotNet, Version=1.0.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net40\packages\EngineIoClientDotNet.1.0.4\lib\net40\EngineIoClientDotNet.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net40\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SuperSocket.ClientEngine, Version=0.9.0.0, Culture=neutral, PublicKeyToken=ee9af13f57f00acc, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net40\packages\SuperSocket.ClientEngine.Core.0.9.0\lib\net40-client\SuperSocket.ClientEngine.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WebSocket4Net, Version=0.15.1.10, Culture=neutral, PublicKeyToken=eb4e154b696bf72a, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net40\packages\WebSocket4Net.0.15.1\lib\net40\WebSocket4Net.dll</HintPath>
</Reference>
<Reference Include="xunit, Version=1.9.2.1705, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net40\packages\xunit.1.9.2\lib\net20\xunit.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\Connection.cs">
<Link>ClientTests\Connection.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\ConnectionConstants.cs">
<Link>ClientTests\ConnectionConstants.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\ServerConnectionTest_net35.cs">
<Link>ClientTests\ServerConnectionTest_net35.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\UrlTest.cs">
<Link>ClientTests\UrlTest.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ModuleTests\HasBinaryDataTest.cs">
<Link>ModuleTests\HasBinaryDataTest.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\ByteArrayTest.cs">
<Link>ParserTests\ByteArrayTest.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\Helpers.cs">
<Link>ParserTests\Helpers.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\ParserTest.cs">
<Link>ParserTests\ParserTest.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SocketIoClientDotNet.net40\SocketIoClientDotNet.net40.csproj">
<Project>{53ae4914-a35b-406c-91ed-7e3d9c950f45}</Project>
<Name>SocketIoClientDotNet.net40</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="config.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,110 @@
<ProjectConfiguration>
<AutoDetectNugetBuildDependencies>true</AutoDetectNugetBuildDependencies>
<BuildPriority>1000</BuildPriority>
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
<AllowCodeAnalysis>false</AllowCodeAnalysis>
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
<RunPreBuildEvents>false</RunPreBuildEvents>
<RunPostBuildEvents>false</RunPostBuildEvents>
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
<TrackFileDependencies>false</TrackFileDependencies>
<InstrumentAssembly>true</InstrumentAssembly>
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
<DetectStackOverflow>true</DetectStackOverflow>
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
<DefaultTestTimeout>60000</DefaultTestTimeout>
<UseBuildConfiguration></UseBuildConfiguration>
<UseBuildPlatform></UseBuildPlatform>
<ProxyProcessPath></ProxyProcessPath>
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
<MSTestThreadApartmentState>STA</MSTestThreadApartmentState>
<BuildProcessArchitecture>x86</BuildProcessArchitecture>
<IgnoredTests>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.D10000CharsTest</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.Json10000000CharsTest</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.Json10000CharsTest</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ReconnectEventShouldFireInSocket</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldEmitDateAsDate</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldEmitDateInObject</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldFireErrorOnSocket</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldFireReconnectEventsOnSocket</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldFireReconnectingOnSocketWithAttemptsNumberWhenReconnectingTwice</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldGetBase64DataAsALastResort</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldGetBinaryDataAsAnArraybuffer</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldNotConnectWhenAutoconnectOptionSetToFalse</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldNotTryToReconnectAndShouldFormAConnectionWhenConnectingToCorrectPortWithDefaultTimeout</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldNotTryToReconnectWithIncorrectPortWhenReconnectionDisabled</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldOpenANewNamespaceAfterConnectionGetsClosed</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReceiveDateWithAck</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReceiveDateWithAckAsAction</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReceiveUtf8MultibyteCharacters</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReconnectByDefault</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldSendBinaryDataAsAnArraybuffer</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldSendBinaryDataAsAnArraybufferMixedWithJson</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldSendEventsWithArraybuffersInTheCorrectOrder</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldTryToReconnectTwiceAndFailWhenRequestedTwoAttemptsWithImmediateTimeoutAndReconnectEnabled</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldTryToReconnectTwiceAndFailWhenRequestedTwoAttemptsWithIncorrectAddressAndReconnectEnabled</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldWorkWithAcks</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldWorkWithFalse</TestName>
</NamedTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ModuleTests.HasBinaryDataTest</FixtureName>
</FixtureTestSelector>
</IgnoredTests>
</ProjectConfiguration>

View File

@@ -0,0 +1,8 @@
<ProjectConfiguration>
<Settings>
<IgnoredTests>
<AllTestsSelector />
</IgnoredTests>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SuperSocket.ClientEngine" publicKeyToken="ee9af13f57f00acc" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.8.0.12" newVersion="0.8.0.12" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" /></startup></configuration>

View File

@@ -0,0 +1,20 @@
{
"version":"0.10.0",
"server":{
"port":80,
"ssl_port":443,
"hostname":"127.0.0.1"
},
"win":{
"powershell":"C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe",
"msbuild":"C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe",
"xunit_path":"C:/Development/quobject.visualstudio.com/EngineIoClientDotNet/Src/EngineIoClientDotNet.net45/packages/xunit.runner.console.2.0.0/tools",
"nuget":"C:/ProgramData/chocolatey/bin/NuGet.exe",
"xamarin_component":"xamarin-component.exe"
},
"linux":{
"msbuild":"xbuild",
"xunit_path":"/home/apollo/vendors/xunit",
"xamarin_component":"xamarin-component"
}
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EngineIoClientDotNet" version="1.0.4" targetFramework="net40" />
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net40" />
<package id="SuperSocket.ClientEngine.Core" version="0.9.0" targetFramework="net40" />
<package id="WebSocket4Net" version="0.15.1" targetFramework="net40" />
<package id="xunit" version="1.9.2" targetFramework="net40" />
</packages>

View File

@@ -0,0 +1,82 @@
using Newtonsoft.Json;
using Quobject.EngineIoClientDotNet.Modules;
using Quobject.SocketIoClientDotNet.Client;
using System.IO;
namespace SocketIoClientDotNet.Tests.ClientTests
{
public class Connection
{
public static readonly int TIMEOUT = 300000;
static Connection()
{
LogManager.SetupLogManager();
}
protected IO.Options CreateOptions()
{
var log = LogManager.GetLogger(Global.CallerName());
var config = ConfigBase.Load();
var options = new IO.Options();
options.Port = config.server.port;
options.Hostname = config.server.hostname;
options.ForceNew = true;
log.Info("Please add to your hosts file: 127.0.0.1 " + options.Hostname);
return options;
}
protected string CreateUri()
{
var options = CreateOptions();
var uri = string.Format("{0}://{1}:{2}", options.Secure ? "https" : "http", options.Hostname, options.Port);
return uri;
}
protected IO.Options CreateOptionsSecure()
{
var log = LogManager.GetLogger(Global.CallerName());
var config = ConfigBase.Load();
var options = new IO.Options();
options.Port = config.server.ssl_port;
options.Hostname = config.server.hostname;
log.Info("Please add to your hosts file: 127.0.0.1 " + options.Hostname);
options.Secure = true;
options.IgnoreServerCertificateValidation = true;
return options;
}
}
public class ConfigBase
{
public string version { get; set; }
public ConfigServer server { get; set; }
public static ConfigBase Load()
{
var result = new ConfigBase()
{
server = new ConfigServer()
};
result.server.hostname = ConnectionConstants.HOSTNAME;
result.server.port = ConnectionConstants.PORT;
result.server.ssl_port = ConnectionConstants.SSL_PORT;
return result;
}
}
public class ConfigServer
{
public string hostname { get; set; }
public int port { get; set; }
public int ssl_port { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SocketIoClientDotNet.Tests.ClientTests
{
public static class ConnectionConstants
{
public static int PORT = 80;
public static string HOSTNAME = "testme.quobject.com";
public static int SSL_PORT = 443;
public static readonly int TIMEOUT = 300000;
}
}

View File

@@ -0,0 +1,78 @@
using Newtonsoft.Json;
using Quobject.EngineIoClientDotNet.Modules;
using Quobject.SocketIoClientDotNet.Client;
using System.IO;
namespace SocketIoClientDotNet.Tests.ClientTests
{
public class Connection
{
public static readonly int TIMEOUT = 300000;
static Connection()
{
LogManager.SetupLogManager();
}
protected IO.Options CreateOptions()
{
//var log = LogManager.GetLogger(Global.CallerName());
var config = ConfigBase.Load();
var options = new IO.Options();
options.Port = config.server.port;
options.Hostname = config.server.hostname;
options.ForceNew = true;
//log.Info("Please add to your hosts file: 127.0.0.1 " + options.Hostname);
return options;
}
protected string CreateUri()
{
var options = CreateOptions();
var uri = string.Format("{0}://{1}:{2}", options.Secure ? "https" : "http", options.Hostname, options.Port);
return uri;
}
protected IO.Options CreateOptionsSecure()
{
//var log = LogManager.GetLogger(Global.CallerName());
var config = ConfigBase.Load();
var options = new IO.Options();
options.Port = config.server.ssl_port;
options.Hostname = config.server.hostname;
//log.Info("Please add to your hosts file: 127.0.0.1 " + options.Hostname);
options.Secure = true;
options.IgnoreServerCertificateValidation = true;
return options;
}
}
public class ConfigBase
{
public string version { get; set; }
public ConfigServer server { get; set; }
public static ConfigBase Load()
{
//var configString = File.ReadAllText("./../../../../grunt/config.json");
var configString = @"{""version"":""0.1.0.0"",""server"":{""port"":80,""ssl_port"":443,""hostname"":""192.168.178.59""},""win"":{""powershell"":""C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe"",""msbuild"":""C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe"",""xunit_path"":""C:/vendors/xunit"",""nuget"":""C:/vendors/nuget/nuget.exe""},""linux"":{""msbuild"":""xbuild"",""xunit_path"":""/home/apollo/vendors/xunit""}}";
var config = JsonConvert.DeserializeObject<ConfigBase>(configString);
return config;
}
}
public class ConfigServer
{
public string hostname { get; set; }
public int port { get; set; }
public int ssl_port { get; set; }
}
}

View File

@@ -0,0 +1,49 @@
using Quobject.SocketIoClientDotNet.Client;
using Xunit;
namespace SocketIoClientDotNet.Tests.ClientTests
{
public class UrlTest
{
[Fact]
public void Parse()
{
const string test = @"http://username:password@host:8080/directory/file?query#ref";
var result = Url.Parse(test);
var str = result.ToString();
Assert.Equal(test,str);
}
[Fact]
public void ParseRelativePath()
{
const string test = @"https://woot.com/test";
var result = Url.Parse(test);
Assert.Equal("https",result.Scheme);
Assert.Equal("woot.com",result.Host);
Assert.Equal("/test",result.LocalPath);
}
[Fact]
public void ParseNoProtocol()
{
const string test = @"//localhost:3000";
var result = Url.Parse(test);
Assert.Equal("http", result.Scheme);
Assert.Equal("localhost", result.Host);
Assert.Equal(3000, result.Port);
}
[Fact]
public void ParseNamespace()
{
var result = Url.Parse(@"http://woot.com/woot");
Assert.Equal("/woot", result.LocalPath);
result = Url.Parse(@"http://google.com");
Assert.Equal("/", result.LocalPath);
result = Url.Parse(@"http://google.com/");
Assert.Equal("/", result.LocalPath);
}
}
}

View File

@@ -0,0 +1,25 @@
using Quobject.SocketIoClientDotNet.Modules;
using Xunit;
namespace SocketIoClientDotNet.Tests.ModuleTests
{
public class HasBinaryDataTest
{
[Fact]
public void ByteArray()
{
Assert.True(HasBinaryData.HasBinary(new byte[0]));
}
//[Fact]
//public void ArrayContainsByteArray()
//{
// var arr = JArray.Parse(@"[1, null, 2]");
// var bytes = System.Text.Encoding.UTF8.GetBytes("asdfasdf");
// var token = JToken.FromObject(bytes);
// arr.Add(token);
// Assert.True(HasBinaryData.HasBinary(arr));
//}
}
}

View File

@@ -0,0 +1,142 @@
using Newtonsoft.Json.Linq;
using Quobject.SocketIoClientDotNet.Parser;
using System.Collections.Generic;
using Xunit;
namespace SocketIoClientDotNet.Tests.ParserTests
{
public class ByteArrayTest
{
[Fact]
public void EncodeByteArray()
{
var packet = new Packet(Parser.BINARY_EVENT)
{
Id = 23,
Nsp = "/woot",
Data = System.Text.Encoding.UTF8.GetBytes("abc")
};
Helpers.TestBin(packet);
}
[Fact]
public void EncodeByteArray2()
{
var packet = new Packet(Parser.BINARY_EVENT)
{
Id = 0,
Nsp = "/",
Data = new byte[2]
};
Helpers.TestBin(packet);
}
[Fact]
public void EncodeByteArrayInJson()
{
var exptected = System.Text.Encoding.UTF8.GetBytes("asdfasdf");
var _args = new List<object> { "buffa" };
_args.Add(exptected);
var data = Packet.Args2JArray(_args);
var packet = new Packet()
{
Type = Parser.BINARY_EVENT,
Id = 999,
Nsp = "/deep",
Data = data
};
Helpers.TestBin(packet);
}
[Fact]
public void EncodeByteArrayDeepInJson()
{
var buf = System.Text.Encoding.UTF8.GetBytes("howdy");
var jobj = new JObject();
jobj.Add("hello","lol");
jobj.Add("message",buf);
jobj.Add("goodbye","gotcha");
var _args = new List<object> { "jsonbuff" };
_args.Add(jobj);
var data = Packet.Args2JArray(_args);
var packet = new Packet()
{
Type = Parser.BINARY_EVENT,
Id = 999,
Nsp = "/deep",
Data = data
};
Helpers.TestBin(packet);
}
// Cannot do any of the following in C# ???
//[Fact]
//public void EncodeDeepBinaryJSONWithNullValue()
//{
// var data = JObject.Parse("{a: \"b\", c: 4, e: {g: null}, h: null}");
// data["h"].Replace(new Byte[9]);
// var packet = new Packet(Parser.BINARY_EVENT)
// {
// Id = 600,
// Nsp = "/",
// Data = data
// };
// Helpers.TestBin(packet);
//}
//[Fact]
//public void EncodeBinaryAckWithByteArray()
//{
// var data = JArray.Parse("[a, null, {}]");
// data[1] = System.Text.Encoding.UTF8.GetBytes("xxx");
// var packet = new Packet(Parser.BINARY_ACK)
// {
// Id = 127,
// Nsp = "/back",
// Data = data
// };
// Helpers.TestBin(packet);
//}
//[Fact]
//public void CleanItselfUpOnClose()
//{
// var packet = new Packet(Parser.ACK)
// {
// Id = 0,
// Nsp = "/",
// Data = System.Text.Encoding.UTF8.GetBytes("abc")
// };
// Encoder.Encode(packet, new Parser.Encoder.CallbackImp((encodedPackets) =>
// {
// var decoder = new Parser.Decoder();
// decoder.On(Parser.Decoder.EVENT_DECODED, new ListenerImpl((args) =>
// {
// throw new Exception("received a packet when not all data was sent.");
// }));
// decoder.Add((string)encodedPackets[0]);
// decoder.Add((byte[])encodedPackets[1]);
// decoder.Destroy();
// Assert.Equal(0, decoder.Reconstructor.Buffers.Count);
// }));
}
}

View File

@@ -0,0 +1,80 @@
using Newtonsoft.Json.Linq;
using Quobject.EngineIoClientDotNet.ComponentEmitter;
using Quobject.SocketIoClientDotNet.Parser;
using System.Text;
using Xunit;
namespace SocketIoClientDotNet.Tests.ParserTests
{
public class Helpers
{
private static Parser.Encoder Encoder = new Parser.Encoder();
public static void Test(Packet obj)
{
Encoder.Encode(obj, new Parser.Encoder.CallbackImp((encodedPackets) =>
{
var decoder = new Parser.Decoder();
decoder.On(Parser.Decoder.EVENT_DECODED, new ListenerImpl((data1) =>
{
var packet = (Packet) data1;
AssertPacket(obj, packet);
}));
decoder.Add((string)encodedPackets[0]);
}));
}
public static void TestBin(Packet obj)
{
object originalData = obj.Data;
Encoder.Encode(obj, new Parser.Encoder.CallbackImp((encodedPackets) =>
{
var decoder = new Parser.Decoder();
decoder.On(Parser.Decoder.EVENT_DECODED, new ListenerImpl((args) =>
{
var packet = (Packet) args;
obj.Data = originalData;
obj.Attachments = -1;
AssertPacket(obj, packet);
}));
foreach (var packet in encodedPackets)
{
if (packet is string)
{
decoder.Add((string)packet);
} else if (packet is byte[])
{
decoder.Add((byte[])packet);
}
}
}));
}
public static void AssertPacket(Packet expected, Packet actual)
{
Assert.Equal(expected.Type, actual.Type);
Assert.Equal(expected.Id, actual.Id);
Assert.Equal(expected.Nsp, actual.Nsp);
Assert.Equal(expected.Attachments, actual.Attachments);
if (expected.Data is JArray)
{
var exp = (JArray) expected.Data;
var act = (JArray) expected.Data;
Assert.Equal(exp.ToString(), act.ToString());
}
else if (expected.Data is JObject)
{
var exp = (JObject) expected.Data;
var act = (JObject) expected.Data;
Assert.Equal(exp.ToString(), act.ToString());
}
else
{
Assert.Equal(expected.Data.ToString(), actual.Data.ToString());
}
}
}
}

View File

@@ -0,0 +1,60 @@
using Newtonsoft.Json.Linq;
using Quobject.EngineIoClientDotNet.ComponentEmitter;
using Quobject.SocketIoClientDotNet.Parser;
using Xunit;
namespace SocketIoClientDotNet.Tests.ParserTests
{
public class ParserTest
{
[Fact]
public void Decode()
{
var decoder = new Parser.Decoder();
var called = false;
decoder.On(Parser.Decoder.EVENT_DECODED, new ListenerImpl((data1) =>
{
called = true;
}));
decoder.Add("0/woot");
Assert.True(called);
}
[Fact]
public void EncodeConnection()
{
var packet = new Packet(Parser.CONNECT) {Nsp = "/woot"};
Helpers.Test(packet);
}
[Fact]
public void EncodeDisconnection()
{
var packet = new Packet(Parser.DISCONNECT) { Nsp = "/woot" };
Helpers.Test(packet);
}
[Fact]
public void EncodeEvent()
{
//var packet = new Packet(Parser.EVENT) { Nsp = "/", Data = JArray.Parse("[\"a\", 1, {}]") };
//Helpers.Test(packet);
//var packet2 = new Packet(Parser.EVENT) { Nsp = "/test", Data = JArray.Parse("[\"a\", 1, {}]") };
//Helpers.Test(packet2);
}
[Fact]
public void EncodeAck()
{
//var packet = new Packet(Parser.ACK) {Id = 123 , Nsp = "/", Data = JArray.Parse("[\"a\", 1, {}]") };
//Helpers.Test(packet);
}
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SocketIoClientDotNet")]
[assembly: AssemblyDescription("Socket.IO Client Library for .Net")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quobject Software")]
[assembly: AssemblyProduct("SocketIoClientDotNet")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a95e75cd-35e6-4e88-9e22-631e3fd01546")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.12")]
[assembly: AssemblyFileVersion("0.9.12")]

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\SocketIoClientDotNet.net45\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\SocketIoClientDotNet.net45\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EE298060-EB11-4787-804E-A1CB7EB2F597}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SocketIoClientDotNet.Tests</RootNamespace>
<AssemblyName>SocketIoClientDotNet.Tests.net45</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EngineIoClientDotNet, Version=1.0.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net45\packages\EngineIoClientDotNet.1.0.4\lib\net45\EngineIoClientDotNet.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net45\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SuperSocket.ClientEngine, Version=0.9.0.0, Culture=neutral, PublicKeyToken=ee9af13f57f00acc, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net45\packages\SuperSocket.ClientEngine.Core.0.9.0\lib\net45\SuperSocket.ClientEngine.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net45\packages\System.Collections.Immutable.1.4.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WebSocket4Net, Version=0.15.1.10, Culture=neutral, PublicKeyToken=eb4e154b696bf72a, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net45\packages\WebSocket4Net.0.15.1\lib\net45\WebSocket4Net.dll</HintPath>
</Reference>
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net45\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net45\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net45\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\SocketIoClientDotNet.net45\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ClientTests\Connection.cs" />
<Compile Include="ClientTests\ConnectionConstants.cs" />
<Compile Include="ClientTests\ServerConnectionTest.cs" />
<Compile Include="ClientTests\UrlTest.cs" />
<Compile Include="ModuleTests\HasBinaryDataTest.cs" />
<Compile Include="ParserTests\ByteArrayTest.cs" />
<Compile Include="ParserTests\Helpers.cs" />
<Compile Include="ParserTests\ParserTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SocketIoClientDotNet.net45\SocketIoClientDotNet.net45.csproj">
<Project>{b4c79cee-4b09-428a-bfe9-b276df4f57fa}</Project>
<Name>SocketIoClientDotNet.net45</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\SocketIoClientDotNet.net45\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\SocketIoClientDotNet.net45\packages\xunit.runner.visualstudio.2.1.0\build\net20\xunit.runner.visualstudio.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,103 @@
<ProjectConfiguration>
<Settings>
<IgnoredTests>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.MessageTest</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.MessageTestHebrew</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.OgsMessageTest</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ReconnectEventShouldFireInSocket</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldEmitDateAsDate</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldEmitDateInObject</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldFireErrorOnSocket</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldFireReconnectEventsOnSocket</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldFireReconnectingOnSocketWithAttemptsNumberWhenReconnectingTwice</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldGetBase64DataAsALastResort</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldGetBinaryDataAsAnArraybuffer</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldNotConnectWhenAutoconnectOptionSetToFalse</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldNotTryToReconnectAndShouldFormAConnectionWhenConnectingToCorrectPortWithDefaultTimeout</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldNotTryToReconnectWithIncorrectPortWhenReconnectionDisabled</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldOpenANewNamespaceAfterConnectionGetsClosed</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReceiveDateWithAck</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReceiveDateWithAckAsAction</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReceiveUtf8MultibyteCharacters</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReconnectByDefault</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldSendBinaryDataAsAnArraybuffer</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldSendBinaryDataAsAnArraybufferMixedWithJson</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldSendEventsWithArraybuffersInTheCorrectOrder</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldTryToReconnectTwiceAndFailWhenRequestedTwoAttemptsWithImmediateTimeoutAndReconnectEnabled</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldTryToReconnectTwiceAndFailWhenRequestedTwoAttemptsWithIncorrectAddressAndReconnectEnabled</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldWorkWithAcks</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldWorkWithAcks2</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldWorkWithFalse</TestName>
</NamedTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ClientTests.UrlTest</FixtureName>
</FixtureTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ModuleTests.HasBinaryDataTest</FixtureName>
</FixtureTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ParserTests.ParserTest</FixtureName>
</FixtureTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ParserTests.ByteArrayTest</FixtureName>
</FixtureTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest</FixtureName>
</FixtureTestSelector>
</IgnoredTests>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebSocket4Net" publicKeyToken="eb4e154b696bf72a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.14.1.0" newVersion="0.14.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SuperSocket.ClientEngine" publicKeyToken="ee9af13f57f00acc" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.8.0.12" newVersion="0.8.0.12" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EngineIoClientDotNet" version="1.0.4" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="SuperSocket.ClientEngine.Core" version="0.9.0" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.4.0" targetFramework="net45" />
<package id="WebSocket4Net" version="0.15.1" targetFramework="net45" />
<package id="xunit" version="2.1.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.1.0" targetFramework="net45" />
</packages>

View File

@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\Connection.cs" Link="ClientTests\Connection.cs" />
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\ConnectionConstants.cs" Link="ClientTests\ConnectionConstants.cs" />
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\ServerConnectionTest.cs" Link="ClientTests\ServerConnectionTest.cs" />
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ClientTests\UrlTest.cs" Link="ClientTests\UrlTest.cs" />
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ModuleTests\HasBinaryDataTest.cs" Link="ModuleTests\HasBinaryDataTest.cs" />
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\ByteArrayTest.cs" Link="ParserTests\ByteArrayTest.cs" />
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\Helpers.cs" Link="ParserTests\Helpers.cs" />
<Compile Include="..\SocketIoClientDotNet.Tests.net45\ParserTests\ParserTest.cs" Link="ParserTests\ParserTest.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="ParserTests\" />
<Folder Include="ModuleTests\" />
<Folder Include="ClientTests\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SocketIoClientDotNet.netstandard1.3\SocketIoClientDotNet.netstandard1.3.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,148 @@
<ProjectConfiguration>
<Settings>
<IgnoredTests>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.Json10000000CharsTest</TestName>
</NamedTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ClientTests.UrlTest</FixtureName>
</FixtureTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.UrlTest.Parse</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.UrlTest.ParseNamespace</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.UrlTest.ParseNoProtocol</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.UrlTest.ParseRelativePath</TestName>
</NamedTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ModuleTests.HasBinaryDataTest</FixtureName>
</FixtureTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ModuleTests.HasBinaryDataTest.ByteArray</TestName>
</NamedTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ParserTests.ByteArrayTest</FixtureName>
</FixtureTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ParserTests.ByteArrayTest.EncodeByteArray</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ParserTests.ByteArrayTest.EncodeByteArray2</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ParserTests.ByteArrayTest.EncodeByteArrayDeepInJson</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ParserTests.ByteArrayTest.EncodeByteArrayInJson</TestName>
</NamedTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ParserTests.ParserTest</FixtureName>
</FixtureTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ParserTests.ParserTest.Decode</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ParserTests.ParserTest.EncodeAck</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ParserTests.ParserTest.EncodeConnection</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ParserTests.ParserTest.EncodeDisconnection</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ParserTests.ParserTest.EncodeEvent</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldTryToReconnectTwiceAndFailWhenRequestedTwoAttemptsWithImmediateTimeoutAndReconnectEnabled</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldTryToReconnectTwiceAndFailWhenRequestedTwoAttemptsWithIncorrectAddressAndReconnectEnabled</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldWorkWithAcks</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldWorkWithAcks2</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldWorkWithFalse</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldSendEventsWithArraybuffersInTheCorrectOrder</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReceiveUtf8MultibyteCharacters</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReconnectByDefault</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldSendBinaryDataAsAnArraybuffer</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldSendBinaryDataAsAnArraybufferMixedWithJson</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldNotTryToReconnectWithIncorrectPortWhenReconnectionDisabled</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldOpenANewNamespaceAfterConnectionGetsClosed</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReceiveDateWithAck</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldReceiveDateWithAckAsAction</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldGetBase64DataAsALastResort</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldGetBinaryDataAsAnArraybuffer</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldNotConnectWhenAutoconnectOptionSetToFalse</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldNotTryToReconnectAndShouldFormAConnectionWhenConnectingToCorrectPortWithDefaultTimeout</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.MessageTest</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.MessageTestHebrew</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.OgsMessageTest</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ReconnectEventShouldFireInSocket</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldEmitDateAsDate</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldEmitDateInObject</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldFireErrorOnSocket</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldFireReconnectEventsOnSocket</TestName>
</NamedTestSelector>
<NamedTestSelector>
<TestName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest.ShouldFireReconnectingOnSocketWithAttemptsNumberWhenReconnectingTwice</TestName>
</NamedTestSelector>
<FixtureTestSelector>
<FixtureName>SocketIoClientDotNet.Tests.ClientTests.ServerConnectionTest</FixtureName>
</FixtureTestSelector>
</IgnoredTests>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SocketIoClientDotNet.mono")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SocketIoClientDotNet.mono")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ebf2fd3d-645f-408b-8595-ab81f67efeed")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9C663463-8A1D-4960-A64A-1E0303034FE2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Quobject.SocketIoClientDotNet</RootNamespace>
<AssemblyName>SocketIoClientDotNet</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EngineIoClientDotNet, Version=0.9.18.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\EngineIoClientDotNet.0.9.18\lib\net45\EngineIoClientDotNet.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WebSocket4Net">
<HintPath>packages\WebSocket4Net.0.12\lib\net45\WebSocket4Net.dll</HintPath>
</Reference>
<Reference Include="xunit">
<HintPath>..\..\References\xunit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SocketIoClientDotNet.net45\Client\AckImpl.cs">
<Link>Client\AckImpl.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\IAck.cs">
<Link>Client\IAck.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\IO.cs">
<Link>Client\IO.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\Manager.cs">
<Link>Client\Manager.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\On.cs">
<Link>Client\On.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\Socket.cs">
<Link>Client\Socket.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\SocketIOException.cs">
<Link>Client\SocketIOException.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\Url.cs">
<Link>Client\Url.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Modules\HasBinaryData.cs">
<Link>Modules\HasBinaryData.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Binary.cs">
<Link>Parser\Binary.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Packet.cs">
<Link>Parser\Packet.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Parser.cs">
<Link>Parser\Parser.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,78 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketIoClientDotNet.mono", "SocketIoClientDotNet.mono.csproj", "{9C663463-8A1D-4960-A64A-1E0303034FE2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketIoClientDotNet.Tests.mono", "..\SocketIoClientDotNet.Tests.mono\SocketIoClientDotNet.Tests.mono.csproj", "{022DE7B5-7AA6-447A-8720-DDF627C384FD}"
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "grunt", "http://localhost:26409", "{78CADA8C-D36D-4887-8E24-665058A9D81A}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Debug.AspNetCompiler.VirtualPath = "/localhost_26409"
Debug.AspNetCompiler.PhysicalPath = "..\..\grunt\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26409\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_26409"
Release.AspNetCompiler.PhysicalPath = "..\..\grunt\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26409\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "..\..\grunt\"
EndProjectSection
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "TestServer", "http://localhost:26412", "{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Debug.AspNetCompiler.VirtualPath = "/localhost_26412"
Debug.AspNetCompiler.PhysicalPath = "..\..\TestServer\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26412\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_26412"
Release.AspNetCompiler.PhysicalPath = "..\..\TestServer\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26412\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "..\..\TestServer\"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9C663463-8A1D-4960-A64A-1E0303034FE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C663463-8A1D-4960-A64A-1E0303034FE2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C663463-8A1D-4960-A64A-1E0303034FE2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C663463-8A1D-4960-A64A-1E0303034FE2}.Release|Any CPU.Build.0 = Release|Any CPU
{022DE7B5-7AA6-447A-8720-DDF627C384FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{022DE7B5-7AA6-447A-8720-DDF627C384FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{022DE7B5-7AA6-447A-8720-DDF627C384FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{022DE7B5-7AA6-447A-8720-DDF627C384FD}.Release|Any CPU.Build.0 = Release|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Release|Any CPU.Build.0 = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Release|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EngineIoClientDotNet" version="0.9.18" targetFramework="net45" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="WebSocket4Net" version="0.12" targetFramework="net45" />
</packages>

View File

@@ -0,0 +1,328 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# TypeScript v1 declaration files
typings/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
OpenCover/
EngineIoClientDotNet_Tests/Resources/test.xml
TestServer/test.xml
TestServer/test.xml
TestServer/test.xml

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Quobject.SocketIoClientDotNet.Collections.Concurrent
{
public class ConcurrentQueue<T>
{
private Queue<T> m_Queue;
private object m_SyncRoot = new object();
public int Count
{
get { return m_Queue.Count; }
}
public void Clear()
{
lock (m_SyncRoot)
{
m_Queue.Clear();
}
}
public List<T> GetEnumerator()
{
lock (m_SyncRoot)
{
var result = new List<T>();
foreach (var item in m_Queue)
{
result.Add((T)item);
}
return result;
}
}
public ConcurrentQueue()
{
m_Queue = new Queue<T>();
}
public ConcurrentQueue(int capacity)
{
m_Queue = new Queue<T>(capacity);
}
public ConcurrentQueue(IEnumerable<T> collection)
{
m_Queue = new Queue<T>(collection);
}
public void Enqueue(T item)
{
lock (m_SyncRoot)
{
m_Queue.Enqueue(item);
}
}
public bool TryDequeue(out T item)
{
lock (m_SyncRoot)
{
if (m_Queue.Count <= 0)
{
item = default(T);
return false;
}
item = m_Queue.Dequeue();
return true;
}
}
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SocketIoClientDotNet")]
[assembly: AssemblyDescription("Socket.IO Client Library for .Net")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quobject Software")]
[assembly: AssemblyProduct("SocketIoClientDotNet")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a95e75cd-35e6-4e88-9e22-631e3fd01546")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5")]
[assembly: AssemblyFileVersion("1.0.5")]

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E3D3A67D-9A1E-4915-8A2D-1C0E4447F5E0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SocketIoClientDotNet</RootNamespace>
<AssemblyName>SocketIoClientDotNet</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\net35\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EngineIoClientDotNet, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\EngineIoClientDotNet.1.0.5\lib\net35\EngineIoClientDotNet.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SuperSocket.ClientEngine, Version=0.9.0.0, Culture=neutral, PublicKeyToken=ee9af13f57f00acc, processorArchitecture=MSIL">
<HintPath>packages\SuperSocket.ClientEngine.Core.0.9.0\lib\net35-client\SuperSocket.ClientEngine.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Threading.Tasks.NET35, Version=3.0.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>packages\System.Threading.Tasks.Unofficial.3.1\lib\net35\System.Threading.Tasks.NET35.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WebSocket4Net, Version=0.15.1.10, Culture=neutral, PublicKeyToken=eb4e154b696bf72a, processorArchitecture=MSIL">
<HintPath>packages\WebSocket4Net.0.15.1\lib\net35\WebSocket4Net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SocketIoClientDotNet.net45\Client\AckImpl.cs">
<Link>Client\AckImpl.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\IAck.cs">
<Link>Client\IAck.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\IO_net35.cs">
<Link>Client\IO_net35.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\Manager_net35.cs">
<Link>Client\Manager_net35.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\On.cs">
<Link>Client\On.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\SocketIOException.cs">
<Link>Client\SocketIOException.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\Socket_net35.cs">
<Link>Client\Socket_net35.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\Url.cs">
<Link>Client\Url.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Modules\HasBinaryData.cs">
<Link>Modules\HasBinaryData.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Binary.cs">
<Link>Parser\Binary.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Packet.cs">
<Link>Parser\Packet.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Parser.cs">
<Link>Parser\Parser.cs</Link>
</Compile>
<Compile Include="Collections.Concurrent\ConcurrentQueue.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Content Include=".gitignore" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,56 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2003
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketIoClientDotNet.net35", "SocketIoClientDotNet.net35.csproj", "{E3D3A67D-9A1E-4915-8A2D-1C0E4447F5E0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketIoClientDotNet.Tests.net35", "..\SocketIoClientDotNet.Tests.net35\SocketIoClientDotNet.Tests.net35.csproj", "{6D90EB17-A71E-4A5F-8BF1-1F7991AEB976}"
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "SocketIoClientDotNet", "..\..\", "{E62008C8-688A-49D1-90A7-D9BCFB0CC4C2}"
ProjectSection(WebsiteProperties) = preProject
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Debug.AspNetCompiler.VirtualPath = "/localhost_9968"
Debug.AspNetCompiler.PhysicalPath = "..\..\..\SocketIoClientDotNet\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_9968\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_9968"
Release.AspNetCompiler.PhysicalPath = "..\..\..\SocketIoClientDotNet\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_9968\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "9968"
SlnRelativePath = "..\..\..\SocketIoClientDotNet\"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E3D3A67D-9A1E-4915-8A2D-1C0E4447F5E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E3D3A67D-9A1E-4915-8A2D-1C0E4447F5E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E3D3A67D-9A1E-4915-8A2D-1C0E4447F5E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E3D3A67D-9A1E-4915-8A2D-1C0E4447F5E0}.Release|Any CPU.Build.0 = Release|Any CPU
{6D90EB17-A71E-4A5F-8BF1-1F7991AEB976}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D90EB17-A71E-4A5F-8BF1-1F7991AEB976}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D90EB17-A71E-4A5F-8BF1-1F7991AEB976}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D90EB17-A71E-4A5F-8BF1-1F7991AEB976}.Release|Any CPU.Build.0 = Release|Any CPU
{E62008C8-688A-49D1-90A7-D9BCFB0CC4C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E62008C8-688A-49D1-90A7-D9BCFB0CC4C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E62008C8-688A-49D1-90A7-D9BCFB0CC4C2}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{E62008C8-688A-49D1-90A7-D9BCFB0CC4C2}.Release|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CE07E1B6-6E4A-4C2C-93C6-CD9F47041A80}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,8 @@
<ProjectConfiguration>
<Settings>
<IgnoredTests>
<AllTestsSelector />
</IgnoredTests>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>

View File

@@ -0,0 +1,6 @@
<SolutionConfiguration>
<Settings>
<AllowParallelTestExecution>False</AllowParallelTestExecution>
<SolutionConfigured>True</SolutionConfigured>
</Settings>
</SolutionConfiguration>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebSocket4Net" publicKeyToken="eb4e154b696bf72a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.11.0.0" newVersion="0.11.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EngineIoClientDotNet" version="1.0.5" targetFramework="net35" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net35" />
<package id="SuperSocket.ClientEngine.Core" version="0.9.0" targetFramework="net35" />
<package id="System.Threading.Tasks.Unofficial" version="3.1" targetFramework="net35" />
<package id="WebSocket4Net" version="0.15.1" targetFramework="net35" />
</packages>

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SocketIoClientDotNet")]
[assembly: AssemblyDescription("Socket.IO Client Library for .Net")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quobject Software")]
[assembly: AssemblyProduct("SocketIoClientDotNet")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a95e75cd-35e6-4e88-9e22-631e3fd01546")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5")]
[assembly: AssemblyFileVersion("1.0.5")]

View File

@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{53AE4914-A35B-406C-91ED-7E3D9C950F45}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SocketIoClientDotNet</RootNamespace>
<AssemblyName>SocketIoClientDotNet</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\net40\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EngineIoClientDotNet, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\EngineIoClientDotNet.1.0.5\lib\net40\EngineIoClientDotNet.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\Newtonsoft.Json.11.0.1\lib\net40\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SuperSocket.ClientEngine, Version=0.10.0.0, Culture=neutral, PublicKeyToken=ee9af13f57f00acc, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\SuperSocket.ClientEngine.Core.0.10.0\lib\net40-client\SuperSocket.ClientEngine.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WebSocket4Net, Version=0.15.2.11, Culture=neutral, PublicKeyToken=eb4e154b696bf72a, processorArchitecture=MSIL">
<HintPath>..\..\..\..\packages\WebSocket4Net.0.15.2\lib\net40\WebSocket4Net.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\SocketIoClientDotNet.net35\Collections.Concurrent\ConcurrentQueue.cs">
<Link>Collections.Concurrent\ConcurrentQueue.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\AckImpl.cs">
<Link>Client\AckImpl.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\IAck.cs">
<Link>Client\IAck.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\IO_net35.cs">
<Link>Client\IO_net35.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\Manager_net35.cs">
<Link>Client\Manager_net35.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\On.cs">
<Link>Client\On.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\SocketIOException.cs">
<Link>Client\SocketIOException.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\Socket_net40.cs">
<Link>Client\Socket_net40.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Client\Url.cs">
<Link>Client\Url.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Modules\HasBinaryData.cs">
<Link>Modules\HasBinaryData.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Binary.cs">
<Link>Parser\Binary.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Packet.cs">
<Link>Parser\Packet.cs</Link>
</Compile>
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Parser.cs">
<Link>Parser\Parser.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,78 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketIoClientDotNet.net40", "SocketIoClientDotNet.net40.csproj", "{53AE4914-A35B-406C-91ED-7E3D9C950F45}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketIoClientDotNet.Tests.net40", "..\SocketIoClientDotNet.Tests.net40\SocketIoClientDotNet.Tests.net40.csproj", "{DD1A4F5E-5606-4989-9DF8-C1BBD50CD850}"
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "grunt", "http://localhost:26409", "{78CADA8C-D36D-4887-8E24-665058A9D81A}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Debug.AspNetCompiler.VirtualPath = "/localhost_26409"
Debug.AspNetCompiler.PhysicalPath = "..\..\grunt\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26409\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_26409"
Release.AspNetCompiler.PhysicalPath = "..\..\grunt\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26409\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "..\..\grunt\"
EndProjectSection
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "TestServer", "http://localhost:26412", "{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Debug.AspNetCompiler.VirtualPath = "/localhost_26412"
Debug.AspNetCompiler.PhysicalPath = "..\..\TestServer\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26412\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_26412"
Release.AspNetCompiler.PhysicalPath = "..\..\TestServer\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26412\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "..\..\TestServer\"
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{53AE4914-A35B-406C-91ED-7E3D9C950F45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{53AE4914-A35B-406C-91ED-7E3D9C950F45}.Debug|Any CPU.Build.0 = Debug|Any CPU
{53AE4914-A35B-406C-91ED-7E3D9C950F45}.Release|Any CPU.ActiveCfg = Release|Any CPU
{53AE4914-A35B-406C-91ED-7E3D9C950F45}.Release|Any CPU.Build.0 = Release|Any CPU
{DD1A4F5E-5606-4989-9DF8-C1BBD50CD850}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD1A4F5E-5606-4989-9DF8-C1BBD50CD850}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD1A4F5E-5606-4989-9DF8-C1BBD50CD850}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD1A4F5E-5606-4989-9DF8-C1BBD50CD850}.Release|Any CPU.Build.0 = Release|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Release|Any CPU.Build.0 = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Release|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,30 @@
<ProjectConfiguration>
<AutoDetectNugetBuildDependencies>true</AutoDetectNugetBuildDependencies>
<BuildPriority>1000</BuildPriority>
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
<AllowCodeAnalysis>false</AllowCodeAnalysis>
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
<RunPreBuildEvents>false</RunPreBuildEvents>
<RunPostBuildEvents>false</RunPostBuildEvents>
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
<TrackFileDependencies>false</TrackFileDependencies>
<InstrumentAssembly>true</InstrumentAssembly>
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
<DetectStackOverflow>true</DetectStackOverflow>
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
<DefaultTestTimeout>60000</DefaultTestTimeout>
<UseBuildConfiguration></UseBuildConfiguration>
<UseBuildPlatform></UseBuildPlatform>
<ProxyProcessPath></ProxyProcessPath>
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
<MSTestThreadApartmentState>STA</MSTestThreadApartmentState>
<BuildProcessArchitecture>x86</BuildProcessArchitecture>
<IgnoredTests>
<AllTestsSelector />
</IgnoredTests>
</ProjectConfiguration>

View File

@@ -0,0 +1,14 @@
<SolutionConfiguration>
<FileVersion>1</FileVersion>
<InferProjectReferencesUsingAssemblyNames>false</InferProjectReferencesUsingAssemblyNames>
<AllowParallelTestExecution>false</AllowParallelTestExecution>
<AllowTestsToRunInParallelWithThemselves>true</AllowTestsToRunInParallelWithThemselves>
<FrameworkUtilisationTypeForNUnit>UseDynamicAnalysis</FrameworkUtilisationTypeForNUnit>
<FrameworkUtilisationTypeForGallio>UseStaticAnalysis</FrameworkUtilisationTypeForGallio>
<FrameworkUtilisationTypeForMSpec>UseStaticAnalysis</FrameworkUtilisationTypeForMSpec>
<FrameworkUtilisationTypeForMSTest>UseStaticAnalysis</FrameworkUtilisationTypeForMSTest>
<FrameworkUtilisationTypeForXUnit2>UseDynamicAnalysis</FrameworkUtilisationTypeForXUnit2>
<NCrunchCacheStoragePath />
<MetricsExclusionList>
</MetricsExclusionList>
</SolutionConfiguration>

View File

@@ -0,0 +1,8 @@
<ProjectConfiguration>
<Settings>
<IgnoredTests>
<AllTestsSelector />
</IgnoredTests>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>

View File

@@ -0,0 +1,6 @@
<SolutionConfiguration>
<Settings>
<AllowParallelTestExecution>False</AllowParallelTestExecution>
<SolutionConfigured>True</SolutionConfigured>
</Settings>
</SolutionConfiguration>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebSocket4Net" publicKeyToken="eb4e154b696bf72a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.15.2.11" newVersion="0.15.2.11" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="SuperSocket.ClientEngine" publicKeyToken="ee9af13f57f00acc" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.10.0.0" newVersion="0.10.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EngineIoClientDotNet" version="1.0.5" targetFramework="net40" />
<package id="Newtonsoft.Json" version="11.0.1" targetFramework="net40" />
<package id="SuperSocket.ClientEngine.Core" version="0.10.0" targetFramework="net40" />
<package id="WebSocket4Net" version="0.15.2" targetFramework="net40" />
</packages>

View File

@@ -0,0 +1,72 @@
using System;
namespace Quobject.SocketIoClientDotNet.Client
{
public class AckImpl : IAck
{
private readonly Action fn0;
private readonly Action<object> fn1;
private readonly Action<object, object> fn2;
private readonly Action<object, object, object> fn3;
private readonly Action<object, object, object, object> fn4;
public AckImpl(Action fn)
{
fn0 = fn;
}
public AckImpl(Action<object> fn)
{
fn1 = fn;
}
public AckImpl(Action<object, object> fn)
{
fn2 = fn;
}
public AckImpl(Action<object, object, object> fn)
{
fn3 = fn;
}
public AckImpl(Action<object, object, object, object> fn)
{
fn4 = fn;
}
public void Call(params object[] args)
{
if (fn0 != null)
{
fn0();
}
else if (fn1 != null)
{
var arg0 = args.Length > 0 ? args[0] : null;
fn1(arg0);
}
else if (fn2 != null)
{
var arg0 = args.Length > 0 ? args[0] : null;
var arg1 = args.Length > 1 ? args[1] : null;
fn2(arg0, arg1);
}
else if (fn3 != null)
{
var arg0 = args.Length > 0 ? args[0] : null;
var arg1 = args.Length > 1 ? args[1] : null;
var arg2 = args.Length > 2 ? args[2] : null;
fn3(arg0, arg1, arg2);
}
else if (fn4 != null)
{
var arg0 = args.Length > 0 ? args[0] : null;
var arg1 = args.Length > 1 ? args[1] : null;
var arg2 = args.Length > 2 ? args[2] : null;
var arg3 = args.Length > 3 ? args[3] : null;
fn4(arg0, arg1, arg2, arg3);
}
}
}
}

View File

@@ -0,0 +1,8 @@

namespace Quobject.SocketIoClientDotNet.Client
{
public interface IAck
{
void Call(params object[] args);
}
}

View File

@@ -0,0 +1,74 @@
using System.Collections.Immutable;
using Quobject.EngineIoClientDotNet.Modules;
using System;
namespace Quobject.SocketIoClientDotNet.Client
{
public class IO
{
private static readonly ImmutableDictionary<string, Manager> Managers = ImmutableDictionary.Create<string, Manager>();
/// <summary>
/// Protocol version
/// </summary>
public static int Protocol = Parser.Parser.protocol;
private IO()
{
}
public static Socket Socket(string uri)
{
return Socket(uri, null);
}
public static Socket Socket(string uri, Options opts)
{
return Socket(Url.Parse(uri), opts);
}
public static Socket Socket(Uri uri)
{
return Socket(uri, null);
}
public static Socket Socket(Uri uri, Options opts)
{
var log = LogManager.GetLogger(Global.CallerName());
if (opts == null)
{
opts = new Options();
}
Manager io;
if (opts.ForceNew || !opts.Multiplex)
{
log.Info(string.Format("ignoring socket cache for {0}", uri.ToString()));
io = new Manager(uri, opts);
}
else
{
var id = Url.ExtractId(uri);
if (!Managers.ContainsKey(id))
{
log.Info( string.Format("new io instance for {0}", id));
Managers.Add(id, new Manager(uri, opts));
}
io = Managers[id];
}
return io.Socket(uri.PathAndQuery);
}
public class Options : Client.Options
{
public bool ForceNew = true;
public bool Multiplex = true;
}
}
}

View File

@@ -0,0 +1,76 @@

using System.Collections.Concurrent;
using Quobject.EngineIoClientDotNet.Modules;
using System;
namespace Quobject.SocketIoClientDotNet.Client
{
public class IO
{
private static readonly ConcurrentDictionary<string, Manager> Managers = new ConcurrentDictionary<string, Manager>();
/// <summary>
/// Protocol version
/// </summary>
public static int Protocol = Parser.Parser.protocol;
private IO()
{
}
public static Socket Socket(string uri)
{
return Socket(uri, null);
}
public static Socket Socket(string uri, Options opts)
{
return Socket(Url.Parse(uri), opts);
}
public static Socket Socket(Uri uri)
{
return Socket(uri, null);
}
public static Socket Socket(Uri uri, Options opts)
{
var log = LogManager.GetLogger(Global.CallerName());
if (opts == null)
{
opts = new Options();
}
Manager io;
if (opts.ForceNew || !opts.Multiplex)
{
log.Info(string.Format("ignoring socket cache for {0}", uri.ToString()));
io = new Manager(uri, opts);
}
else
{
var id = Url.ExtractId(uri);
if (!Managers.ContainsKey(id))
{
log.Info( string.Format("new io instance for {0}", id));
Managers.TryAdd(id, new Manager(uri, opts));
}
io = Managers[id];
}
return io.Socket(uri.PathAndQuery);
}
public class Options : Client.Options
{
public bool ForceNew = true;
public bool Multiplex = true;
}
}
}

View File

@@ -0,0 +1,550 @@
using System.Collections.Immutable;
using Quobject.EngineIoClientDotNet.ComponentEmitter;
using Quobject.EngineIoClientDotNet.Modules;
using Quobject.EngineIoClientDotNet.Thread;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;
namespace Quobject.SocketIoClientDotNet.Client
{
public class Manager : Emitter
{
public enum ReadyStateEnum
{
OPENING,
OPEN,
CLOSED
}
public static readonly string EVENT_OPEN = "open";
public static readonly string EVENT_CLOSE = "close";
public static readonly string EVENT_PACKET = "packet";
public static readonly string EVENT_ERROR = "error";
public static readonly string EVENT_CONNECT_ERROR = "connect_error";
public static readonly string EVENT_CONNECT_TIMEOUT = "connect_timeout";
public static readonly string EVENT_RECONNECT = "reconnect";
public static readonly string EVENT_RECONNECT_ERROR = "reconnect_error";
public static readonly string EVENT_RECONNECT_FAILED = "reconnect_failed";
public static readonly string EVENT_RECONNECT_ATTEMPT = "reconnect_attempt";
public static readonly string EVENT_RECONNECTING = "reconnecting";
/*package*/
public ReadyStateEnum ReadyState = ReadyStateEnum.CLOSED;
private bool _reconnection;
private bool SkipReconnect;
private bool Reconnecting;
private bool Encoding;
private bool OpenReconnect;
private int _reconnectionAttempts;
private long _reconnectionDelay;
private long _reconnectionDelayMax;
private long _timeout;
private int Attempts;
private Uri Uri;
private List<Parser.Packet> PacketBuffer;
private ConcurrentQueue<On.IHandle> Subs;
private Quobject.EngineIoClientDotNet.Client.Socket.Options Opts;
private bool AutoConnect;
private HashSet<Socket> OpeningSockets;
/*package*/
public Quobject.EngineIoClientDotNet.Client.Socket EngineSocket;
private Parser.Parser.Encoder Encoder;
private Parser.Parser.Decoder Decoder;
/**
* This ImmutableDictionary can be accessed from outside of EventThread.
*/
private ImmutableDictionary<string, Socket> Nsps;
public Manager() : this(null, null)
{
}
public Manager(Uri uri) : this(uri, null)
{
}
public Manager(Options opts) : this(null, opts)
{
}
public Manager(Uri uri, Options opts)
{
if (opts == null)
{
opts = new Options();
}
if (opts.Path == null)
{
opts.Path = "/socket.io";
}
this.Opts = opts;
this.Nsps = ImmutableDictionary.Create<string, Socket>();
this.Subs = new ConcurrentQueue<On.IHandle>();
this.Reconnection(opts.Reconnection);
this.ReconnectionAttempts(opts.ReconnectionAttempts != 0 ? opts.ReconnectionAttempts : int.MaxValue);
this.ReconnectionDelay(opts.ReconnectionDelay != 0 ? opts.ReconnectionDelay : 1000);
this.ReconnectionDelayMax(opts.ReconnectionDelayMax != 0 ? opts.ReconnectionDelayMax : 5000);
this.Timeout(opts.Timeout < 0 ? 20000 : opts.Timeout);
this.ReadyState = ReadyStateEnum.CLOSED;
this.Uri = uri;
this.Attempts = 0;
this.Encoding = false;
this.PacketBuffer = new List<Parser.Packet>();
this.OpeningSockets = new HashSet<Socket>();
this.Encoder = new Parser.Parser.Encoder();
this.Decoder = new Parser.Parser.Decoder();
this.AutoConnect = opts.AutoConnect;
if (AutoConnect)
{
Open();
}
}
private void EmitAll(string eventString, params object[] args)
{
Emit(eventString, args);
foreach (var socket in Nsps.Values)
{
socket.Emit(eventString, args);
}
}
public bool Reconnection()
{
return _reconnection;
}
private Manager Reconnection(bool v)
{
_reconnection = v;
return this;
}
public int ReconnectionAttempts()
{
return _reconnectionAttempts;
}
private Manager ReconnectionAttempts(int v)
{
_reconnectionAttempts = v;
return this;
}
public long ReconnectionDelay()
{
return _reconnectionDelay;
}
private Manager ReconnectionDelay(long v)
{
_reconnectionDelay = v;
return this;
}
public long ReconnectionDelayMax()
{
return _reconnectionDelayMax;
}
private Manager ReconnectionDelayMax(long v)
{
_reconnectionDelayMax = v;
return this;
}
public long Timeout()
{
return _timeout;
}
private Manager Timeout(long v)
{
_timeout = v;
return this;
}
private void MaybeReconnectOnOpen()
{
if (!this.OpenReconnect && !this.Reconnecting && this._reconnection)
{
this.OpenReconnect = true;
this.Reconnect();
}
}
public Manager Open()
{
return Open(null);
}
private Manager Open(IOpenCallback fn)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("readyState {0}", ReadyState));
if (ReadyState == ReadyStateEnum.OPEN)
{
return this;
}
log.Info(string.Format("opening {0}", Uri));
EngineSocket = new Engine(Uri, Opts);
Quobject.EngineIoClientDotNet.Client.Socket socket = EngineSocket;
ReadyState = ReadyStateEnum.OPENING;
OpeningSockets.Add(Socket(Uri.PathAndQuery));
SkipReconnect = false;
var openSub = SocketIoClientDotNet.Client.On.Create(socket, Engine.EVENT_OPEN, new ListenerImpl(() =>
{
OnOpen();
if (fn != null)
{
fn.Call(null);
}
}));
var errorSub = Client.On.Create(socket, Engine.EVENT_ERROR, new ListenerImpl((data) =>
{
log.Info("connect_error");
Cleanup();
ReadyState = ReadyStateEnum.CLOSED;
EmitAll(EVENT_CONNECT_ERROR, data);
if (fn != null)
{
var err = new SocketIOException("Connection error", data is Exception ? (Exception) data : null);
fn.Call(err);
}
MaybeReconnectOnOpen();
}));
if (_timeout >= 0)
{
var timeout = (int) _timeout;
log.Info(string.Format("connection attempt will timeout after {0}", timeout));
var timer = EasyTimer.SetTimeout(() =>
{
var log2 = LogManager.GetLogger(Global.CallerName());
log2.Info("Manager Open start");
log2.Info(string.Format("connect attempt timed out after {0}", timeout));
openSub.Destroy();
socket.Close();
socket.Emit(Engine.EVENT_ERROR, new SocketIOException("timeout"));
EmitAll(EVENT_CONNECT_TIMEOUT, timeout);
log2.Info("Manager Open finish");
}, timeout);
Subs.Enqueue(new On.ActionHandleImpl(timer.Stop));
;
}
Subs.Enqueue(openSub);
Subs.Enqueue(errorSub);
EngineSocket.Open();
return this;
}
private void OnOpen()
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info("open");
Cleanup();
ReadyState = ReadyStateEnum.OPEN;
Emit(EVENT_OPEN);
var socket = EngineSocket;
var sub = Client.On.Create(socket, Engine.EVENT_DATA, new ListenerImpl((data) =>
{
if (data is string)
{
OnData((string)data);
}
else if (data is byte[])
{
Ondata((byte[])data);
}
}));
Subs.Enqueue(sub);
sub = Client.On.Create(this.Decoder, Parser.Parser.Decoder.EVENT_DECODED, new ListenerImpl((data) =>
{
OnDecoded((Parser.Packet)data);
}));
Subs.Enqueue(sub);
sub = Client.On.Create(socket, Engine.EVENT_ERROR, new ListenerImpl((data) =>
{
OnError((Exception) data);
}));
Subs.Enqueue(sub);
sub = Client.On.Create(socket, Engine.EVENT_CLOSE, new ListenerImpl((data) =>
{
OnClose((string) data);
}));
Subs.Enqueue(sub);
}
private void OnData(string data)
{
this.Decoder.Add(data);
}
private void Ondata(byte[] data)
{
this.Decoder.Add(data);
}
private void OnDecoded(Parser.Packet packet)
{
this.Emit(EVENT_PACKET, packet);
}
private void OnError(Exception err)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Error("error", err);
this.EmitAll(EVENT_ERROR, err);
}
public Socket Socket(string nsp)
{
if (Nsps.ContainsKey(nsp))
{
return Nsps[nsp];
}
var socket = new Socket(this,nsp);
Nsps = Nsps.Add(nsp, socket);
return socket;
}
internal void Destroy(Socket socket)
{
OpeningSockets.Remove(socket);
if (OpeningSockets.Count == 0)
{
Close();
}
}
internal void Packet(Parser.Packet packet)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("writing packet {0}", packet));
if (!Encoding)
{
Encoding = true;
Encoder.Encode(packet, new Parser.Parser.Encoder.CallbackImp((data) =>
{
var encodedPackets = (object[]) data;
foreach (var packet1 in encodedPackets)
{
if (packet1 is string)
{
EngineSocket.Write((string) packet1);
}
else if (packet1 is byte[])
{
EngineSocket.Write((byte[]) packet1);
}
}
Encoding = false;
ProcessPacketQueue();
}));
}
else
{
PacketBuffer.Add(packet);
}
}
private void ProcessPacketQueue()
{
if (this.PacketBuffer.Count > 0 && !this.Encoding)
{
Parser.Packet pack = this.PacketBuffer[0];
PacketBuffer.Remove(pack);
this.Packet(pack);
}
}
private void Cleanup()
{
// dequeue and destroy until empty
while (Subs.TryDequeue(out On.IHandle sub))
{
sub.Destroy();
}
}
public void Close()
{
this.SkipReconnect = true;
this.Reconnecting = false;
if (ReadyState != ReadyStateEnum.OPEN)
{
Cleanup();
}
ReadyState = ReadyStateEnum.CLOSED;
if (EngineSocket != null)
{
this.EngineSocket.Close();
}
}
private void OnClose(string reason)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info("start");
Cleanup();
ReadyState = ReadyStateEnum.CLOSED;
Emit(EVENT_CLOSE, reason);
if (_reconnection && !SkipReconnect)
{
Reconnect();
}
}
private void Reconnect()
{
var log = LogManager.GetLogger(Global.CallerName());
if (Reconnecting || SkipReconnect)
{
return;
}
Attempts++;
if (Attempts > _reconnectionAttempts)
{
log.Info("reconnect failed");
EmitAll(EVENT_RECONNECT_FAILED);
Reconnecting = false;
}
else
{
var delay = Attempts*ReconnectionDelay();
delay = Math.Min(delay, ReconnectionDelayMax());
log.Info(string.Format("will wait {0}ms before reconnect attempt", delay));
Reconnecting = true;
var timer = EasyTimer.SetTimeout(() =>
{
var log2 = LogManager.GetLogger(Global.CallerName());
log2.Info("EasyTimer Reconnect start");
log2.Info(string.Format("attempting reconnect"));
EmitAll(EVENT_RECONNECT_ATTEMPT, Attempts);
EmitAll(EVENT_RECONNECTING, Attempts);
Open(new OpenCallbackImp((err) =>
{
if (err != null)
{
log.Error("reconnect attempt error", (Exception) err);
Reconnecting = false;
Reconnect();
EmitAll(EVENT_RECONNECT_ERROR, (Exception) err);
}
else
{
log.Info("reconnect success");
OnReconnect();
}
}));
log2.Info("EasyTimer Reconnect finish");
}, (int)delay);
Subs.Enqueue(new On.ActionHandleImpl(timer.Stop));
}
}
private void OnReconnect()
{
int attempts = this.Attempts;
this.Attempts = 0;
this.Reconnecting = false;
this.EmitAll(EVENT_RECONNECT, attempts);
}
public interface IOpenCallback
{
void Call(Exception err);
}
public class OpenCallbackImp : IOpenCallback
{
private Action<object> Fn;
public OpenCallbackImp(Action<object> fn)
{
Fn = fn;
}
public void Call(Exception err)
{
Fn(err);
}
}
}
public class Engine : Quobject.EngineIoClientDotNet.Client.Socket
{
public Engine(Uri uri, Options opts) : base(uri, opts)
{
}
}
public class Options : Quobject.EngineIoClientDotNet.Client.Socket.Options
{
public bool Reconnection = true;
public int ReconnectionAttempts;
public long ReconnectionDelay;
public long ReconnectionDelayMax;
public long Timeout = -1;
public bool AutoConnect = true;
}
}

View File

@@ -0,0 +1,562 @@

using Quobject.EngineIoClientDotNet.ComponentEmitter;
using Quobject.EngineIoClientDotNet.Modules;
using Quobject.EngineIoClientDotNet.Thread;
using System;
using System.Collections.Generic;
using System.Text;
namespace Quobject.SocketIoClientDotNet.Client
{
public class Manager : Emitter
{
public enum ReadyStateEnum
{
OPENING,
OPEN,
CLOSED
}
public static readonly string EVENT_OPEN = "open";
public static readonly string EVENT_CLOSE = "close";
public static readonly string EVENT_PACKET = "packet";
public static readonly string EVENT_ERROR = "error";
public static readonly string EVENT_CONNECT_ERROR = "connect_error";
public static readonly string EVENT_CONNECT_TIMEOUT = "connect_timeout";
public static readonly string EVENT_RECONNECT = "reconnect";
public static readonly string EVENT_RECONNECT_ERROR = "reconnect_error";
public static readonly string EVENT_RECONNECT_FAILED = "reconnect_failed";
public static readonly string EVENT_RECONNECT_ATTEMPT = "reconnect_attempt";
public static readonly string EVENT_RECONNECTING = "reconnecting";
/*package*/
public ReadyStateEnum ReadyState = ReadyStateEnum.CLOSED;
private bool _reconnection;
private bool SkipReconnect;
private bool Reconnecting;
private bool Encoding;
private bool OpenReconnect;
private int _reconnectionAttempts;
private long _reconnectionDelay;
private long _reconnectionDelayMax;
private long _timeout;
private int Connected;
private int Attempts;
private Uri Uri;
private List<Parser.Packet> PacketBuffer;
private Queue<On.IHandle> Subs;
private Quobject.EngineIoClientDotNet.Client.Socket.Options Opts;
private bool AutoConnect;
/*package*/
public Quobject.EngineIoClientDotNet.Client.Socket EngineSocket;
private Parser.Parser.Encoder Encoder;
private Parser.Parser.Decoder Decoder;
/**
* This ConcurrentDictionary can be accessed from outside of EventThread.
*/
private System.Collections.Concurrent.ConcurrentDictionary<string, Socket> Nsps;
public Manager() : this(null, null)
{
}
public Manager(Uri uri) : this(uri, null)
{
}
public Manager(Options opts) : this(null, opts)
{
}
public Manager(Uri uri, Options opts)
{
if (opts == null)
{
opts = new Options();
}
if (opts.Path == null)
{
opts.Path = "/socket.io";
}
this.Opts = opts;
this.Nsps = new System.Collections.Concurrent.ConcurrentDictionary<string, Socket>();
this.Subs = new Queue<On.IHandle>();
this.Reconnection(opts.Reconnection);
this.ReconnectionAttempts(opts.ReconnectionAttempts != 0 ? opts.ReconnectionAttempts : int.MaxValue);
this.ReconnectionDelay(opts.ReconnectionDelay != 0 ? opts.ReconnectionDelay : 1000);
this.ReconnectionDelayMax(opts.ReconnectionDelayMax != 0 ? opts.ReconnectionDelayMax : 5000);
this.Timeout(opts.Timeout < 0 ? 20000 : opts.Timeout);
this.ReadyState = ReadyStateEnum.CLOSED;
this.Uri = uri;
this.Connected = 0;
this.Attempts = 0;
this.Encoding = false;
this.PacketBuffer = new List<Parser.Packet>();
this.Encoder = new Parser.Parser.Encoder();
this.Decoder = new Parser.Parser.Decoder();
this.AutoConnect = opts.AutoConnect;
if (AutoConnect)
{
Open();
}
}
private void EmitAll(string eventString, params object[] args)
{
Emit(eventString, args);
foreach (var socket in Nsps.Values)
{
socket.Emit(eventString, args);
}
}
public bool Reconnection()
{
return _reconnection;
}
private Manager Reconnection(bool v)
{
_reconnection = v;
return this;
}
public int ReconnectionAttempts()
{
return _reconnectionAttempts;
}
private Manager ReconnectionAttempts(int v)
{
_reconnectionAttempts = v;
return this;
}
public long ReconnectionDelay()
{
return _reconnectionDelay;
}
private Manager ReconnectionDelay(long v)
{
_reconnectionDelay = v;
return this;
}
public long ReconnectionDelayMax()
{
return _reconnectionDelayMax;
}
private Manager ReconnectionDelayMax(long v)
{
_reconnectionDelayMax = v;
return this;
}
public long Timeout()
{
return _timeout;
}
private Manager Timeout(long v)
{
_timeout = v;
return this;
}
private void MaybeReconnectOnOpen()
{
if (!this.OpenReconnect && !this.Reconnecting && this._reconnection)
{
this.OpenReconnect = true;
this.Reconnect();
}
}
public Manager Open()
{
return Open(null);
}
private Manager Open(IOpenCallback fn)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("readyState {0}", ReadyState));
if (ReadyState == ReadyStateEnum.OPEN)
{
return this;
}
log.Info(string.Format("opening {0}", Uri));
EngineSocket = new Engine(Uri, Opts);
Quobject.EngineIoClientDotNet.Client.Socket socket = EngineSocket;
ReadyState = ReadyStateEnum.OPENING;
var openSub = SocketIoClientDotNet.Client.On.Create(socket, Engine.EVENT_OPEN, new ListenerImpl(() =>
{
OnOpen();
if (fn != null)
{
fn.Call(null);
}
}));
var errorSub = Client.On.Create(socket, Engine.EVENT_ERROR, new ListenerImpl((data) =>
{
log.Info("connect_error");
Cleanup();
ReadyState = ReadyStateEnum.CLOSED;
EmitAll(EVENT_CONNECT_ERROR, data);
if (fn != null)
{
var err = new SocketIOException("Connection error", data is Exception ? (Exception) data : null);
fn.Call(err);
}
MaybeReconnectOnOpen();
}));
if (_timeout >= 0)
{
var timeout = (int) _timeout;
log.Info(string.Format("connection attempt will timeout after {0}", timeout));
var timer = EasyTimer.SetTimeout(() =>
{
var log2 = LogManager.GetLogger(Global.CallerName());
log2.Info("Manager Open start");
log2.Info(string.Format("connect attempt timed out after {0}", timeout));
openSub.Destroy();
socket.Close();
socket.Emit(Engine.EVENT_ERROR, new SocketIOException("timeout"));
EmitAll(EVENT_CONNECT_TIMEOUT, timeout);
log2.Info("Manager Open finish");
}, timeout);
lock (Subs)
{
Subs.Enqueue(new On.ActionHandleImpl(timer.Stop));
}
}
lock (Subs)
{
Subs.Enqueue(openSub);
Subs.Enqueue(errorSub);
}
EngineSocket.Open();
return this;
}
private void OnOpen()
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info("open");
Cleanup();
ReadyState = ReadyStateEnum.OPEN;
Emit(EVENT_OPEN);
var socket = EngineSocket;
var sub = Client.On.Create(socket, Engine.EVENT_DATA, new ListenerImpl((data) =>
{
if (data is string)
{
OnData((string)data);
}
else if (data is byte[])
{
Ondata((byte[])data);
}
}));
lock (Subs)
{
Subs.Enqueue(sub);
}
sub = Client.On.Create(this.Decoder, Parser.Parser.Decoder.EVENT_DECODED, new ListenerImpl((data) =>
{
OnDecoded((Parser.Packet)data);
}));
lock (Subs)
{
Subs.Enqueue(sub);
}
sub = Client.On.Create(socket, Engine.EVENT_ERROR, new ListenerImpl((data) =>
{
OnError((Exception) data);
}));
lock (Subs)
{
Subs.Enqueue(sub);
}
sub = Client.On.Create(socket, Engine.EVENT_CLOSE, new ListenerImpl((data) =>
{
OnClose((string) data);
}));
lock (Subs)
{
Subs.Enqueue(sub);
}
}
private void OnData(string data)
{
this.Decoder.Add(data);
}
private void Ondata(byte[] data)
{
this.Decoder.Add(data);
}
private void OnDecoded(Parser.Packet packet)
{
this.Emit(EVENT_PACKET, packet);
}
private void OnError(Exception err)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Error("error", err);
this.EmitAll(EVENT_ERROR, err);
}
public Socket Socket(string nsp)
{
if (Nsps.ContainsKey(nsp))
{
return Nsps[nsp];
}
var socket = new Socket(this,nsp);
Nsps.TryAdd(nsp, socket);
socket.On(Client.Socket.EVENT_CONNECT, new ListenerImpl(() =>
{
Connected++;
}));
return socket;
}
internal void Destroy(Socket socket)
{
--Connected;
if (Connected == 0)
{
Close();
}
}
internal void Packet(Parser.Packet packet)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("writing packet {0}", packet));
if (!Encoding)
{
Encoding = true;
Encoder.Encode(packet, new Parser.Parser.Encoder.CallbackImp((data) =>
{
var encodedPackets = (object[]) data;
foreach (var packet1 in encodedPackets)
{
if (packet1 is string)
{
EngineSocket.Write((string) packet1);
}
else if (packet1 is byte[])
{
EngineSocket.Write((byte[]) packet1);
}
}
Encoding = false;
ProcessPacketQueue();
}));
}
else
{
PacketBuffer.Add(packet);
}
}
private void ProcessPacketQueue()
{
if (this.PacketBuffer.Count > 0 && !this.Encoding)
{
Parser.Packet pack = this.PacketBuffer[0];
PacketBuffer.Remove(pack);
this.Packet(pack);
}
}
private void Cleanup()
{
lock (Subs)
{
foreach (var sub in Subs)
{
sub.Destroy();
}
Subs.Clear();
}
}
public void Close()
{
this.SkipReconnect = true;
this.EngineSocket.Close();
}
private void OnClose(string reason)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info("start");
Cleanup();
ReadyState = ReadyStateEnum.CLOSED;
Emit(EVENT_CLOSE, reason);
if (_reconnection && !SkipReconnect)
{
Reconnect();
}
}
private void Reconnect()
{
var log = LogManager.GetLogger(Global.CallerName());
if (Reconnecting)
{
return;
}
Attempts++;
if (Attempts > _reconnectionAttempts)
{
log.Info("reconnect failed");
EmitAll(EVENT_RECONNECT_FAILED);
Reconnecting = false;
}
else
{
var delay = Attempts*ReconnectionDelay();
delay = Math.Min(delay, ReconnectionDelayMax());
log.Info(string.Format("will wait {0}ms before reconnect attempt", delay));
Reconnecting = true;
var timer = EasyTimer.SetTimeout(() =>
{
var log2 = LogManager.GetLogger(Global.CallerName());
log2.Info("EasyTimer Reconnect start");
log2.Info(string.Format("attempting reconnect"));
EmitAll(EVENT_RECONNECT_ATTEMPT, Attempts);
EmitAll(EVENT_RECONNECTING, Attempts);
Open(new OpenCallbackImp((err) =>
{
if (err != null)
{
log.Error("reconnect attempt error", (Exception) err);
Reconnecting = false;
Reconnect();
EmitAll(EVENT_RECONNECT_ERROR, (Exception) err);
}
else
{
log.Info("reconnect success");
OnReconnect();
}
}));
log2.Info("EasyTimer Reconnect finish");
}, (int)delay);
lock (Subs){
Subs.Enqueue(new On.ActionHandleImpl(timer.Stop));
}
}
}
private void OnReconnect()
{
int attempts = this.Attempts;
this.Attempts = 0;
this.Reconnecting = false;
this.EmitAll(EVENT_RECONNECT, attempts);
}
public interface IOpenCallback
{
void Call(Exception err);
}
public class OpenCallbackImp : IOpenCallback
{
private Action<object> Fn;
public OpenCallbackImp(Action<object> fn)
{
Fn = fn;
}
public void Call(Exception err)
{
Fn(err);
}
}
}
public class Engine : Quobject.EngineIoClientDotNet.Client.Socket
{
public Engine(Uri uri, Options opts) : base(uri, opts)
{
}
}
public class Options : Quobject.EngineIoClientDotNet.Client.Socket.Options
{
public bool Reconnection = true;
public int ReconnectionAttempts;
public long ReconnectionDelay;
public long ReconnectionDelayMax;
public long Timeout = -1;
public bool AutoConnect = true;
public bool DisablePing = false;
}
}

View File

@@ -0,0 +1,57 @@
using Quobject.EngineIoClientDotNet.ComponentEmitter;
using System;
namespace Quobject.SocketIoClientDotNet.Client
{
public class On
{
private On() { }
public static IHandle Create(Emitter obj, string ev, IListener fn)
{
obj.On(ev, fn);
return new HandleImpl(obj,ev,fn);
}
public class HandleImpl : IHandle
{
private Emitter obj;
private string ev;
private IListener fn;
public HandleImpl(Emitter obj, string ev, IListener fn)
{
this.obj = obj;
this.ev = ev;
this.fn = fn;
}
public void Destroy()
{
obj.Off(ev, fn);
}
}
public class ActionHandleImpl : IHandle
{
private Action fn;
public ActionHandleImpl(Action fn)
{
this.fn = fn;
}
public void Destroy()
{
fn();
}
}
public interface IHandle
{
void Destroy();
}
}
}

View File

@@ -0,0 +1,438 @@
using Newtonsoft.Json.Linq;
using System.Collections.Immutable;
using Quobject.EngineIoClientDotNet.ComponentEmitter;
using Quobject.EngineIoClientDotNet.Modules;
using Quobject.SocketIoClientDotNet.Modules;
using Quobject.SocketIoClientDotNet.Parser;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Quobject.SocketIoClientDotNet.Client
{
public class Socket : Emitter
{
public static readonly string EVENT_CONNECT = "connect";
public static readonly string EVENT_DISCONNECT = "disconnect";
public static readonly string EVENT_ERROR = "error";
public static readonly string EVENT_MESSAGE = "message";
public static readonly string EVENT_CONNECT_ERROR = Manager.EVENT_CONNECT_ERROR;
public static readonly string EVENT_CONNECT_TIMEOUT = Manager.EVENT_CONNECT_TIMEOUT;
public static readonly string EVENT_RECONNECT = Manager.EVENT_RECONNECT;
public static readonly string EVENT_RECONNECT_ERROR = Manager.EVENT_RECONNECT_ERROR;
public static readonly string EVENT_RECONNECT_FAILED = Manager.EVENT_RECONNECT_FAILED;
public static readonly string EVENT_RECONNECT_ATTEMPT = Manager.EVENT_RECONNECT_ATTEMPT;
public static readonly string EVENT_RECONNECTING = Manager.EVENT_RECONNECTING;
private static readonly List<string> Events = new List<string>()
{
EVENT_CONNECT,
EVENT_CONNECT_ERROR,
EVENT_CONNECT_TIMEOUT,
EVENT_DISCONNECT,
EVENT_ERROR,
EVENT_RECONNECT,
EVENT_RECONNECT_ATTEMPT,
EVENT_RECONNECT_FAILED,
EVENT_RECONNECT_ERROR,
EVENT_RECONNECTING
};
private bool Connected;
//private bool Disconnected = true;
private int Ids;
private string Nsp;
private Manager _io;
private ImmutableDictionary<int, IAck> Acks = ImmutableDictionary.Create<int, IAck>();
private ImmutableQueue<On.IHandle> Subs;
private ImmutableQueue<List<object>> ReceiveBuffer = ImmutableQueue.Create<List<object>>();
private ImmutableQueue<Parser.Packet> SendBuffer = ImmutableQueue.Create<Parser.Packet>();
public Socket(Manager io, string nsp)
{
_io = io;
Nsp = nsp;
this.SubEvents();
}
private void SubEvents()
{
Manager io = _io;
Subs = ImmutableQueue.Create<On.IHandle>();
Subs = Subs.Enqueue(Client.On.Create(io, Manager.EVENT_OPEN, new ListenerImpl(OnOpen)));
Subs = Subs.Enqueue(Client.On.Create(io, Manager.EVENT_PACKET, new ListenerImpl((data) => OnPacket((Packet)data))));
Subs = Subs.Enqueue(Client.On.Create(io, Manager.EVENT_CLOSE, new ListenerImpl((data) => OnClose((string)data))));
}
public Socket Open()
{
Task.Run(() =>
{
if (!Connected)
{
_io.Open();
if (_io.ReadyState == Manager.ReadyStateEnum.OPEN)
{
OnOpen();
}
}
});
return this;
}
public Socket Connect()
{
return this.Open();
}
public Socket Send(params object[] args)
{
Emit(EVENT_MESSAGE, args);
return this;
}
public override Emitter Emit(string eventString, params object[] args)
{
var log = LogManager.GetLogger(Global.CallerName());
if (Events.Contains(eventString))
{
base.Emit(eventString, args);
return this;
}
var _args = new List<object> { eventString };
_args.AddRange(args);
var ack = _args[_args.Count - 1] as IAck;
if (ack != null)
{
_args.RemoveAt(_args.Count - 1);
}
var jsonArgs = Parser.Packet.Args2JArray(_args);
var parserType = HasBinaryData.HasBinary(jsonArgs) ? Parser.Parser.BINARY_EVENT : Parser.Parser.EVENT;
var packet = new Packet(parserType, jsonArgs);
if (ack != null)
{
log.Info(string.Format("emitting packet with ack id {0}", Ids));
Acks = Acks.Add(Ids, ack);
packet.Id = Ids++;
}
if (Connected)
{
Packet(packet);
}
else
{
SendBuffer = SendBuffer.Enqueue(packet);
}
return this;
}
public Emitter Emit(string eventString, IAck ack, params object[] args)
{
var log = LogManager.GetLogger(Global.CallerName());
if (Events.Contains(eventString))
{
base.Emit(eventString, args);
return this;
}
var _args = new List<object> { eventString };
_args.AddRange(args);
var jsonArgs = Parser.Packet.Args2JArray(_args);
var parserType = HasBinaryData.HasBinary(jsonArgs) ? Parser.Parser.BINARY_EVENT : Parser.Parser.EVENT;
var packet = new Packet(parserType, jsonArgs);
log.Info(string.Format("emitting packet with ack id {0}", Ids));
Acks = Acks.Add(Ids, ack);
packet.Id = Ids++;
if (Connected)
{
Packet(packet);
}
else
{
SendBuffer = SendBuffer.Enqueue(packet);
}
return this;
}
public Emitter Emit(string eventString, Action ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public Emitter Emit(string eventString, Action<object> ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public Emitter Emit(string eventString, Action<object, object> ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public Emitter Emit(string eventString, Action<object, object, object> ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public Emitter Emit(string eventString, Action<object, object, object, object> ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public void Packet(Packet packet)
{
packet.Nsp = Nsp;
_io.Packet(packet);
}
private void OnOpen()
{
//var log = LogManager.GetLogger(Global.CallerName());
if (Nsp != "/")
{
Packet(new Packet(Parser.Parser.CONNECT));
}
}
private void OnClose(string reason)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("close ({0})", reason));
Connected = false;
Emit(EVENT_DISCONNECT, reason);
}
private void OnPacket(Packet packet)
{
if (Nsp != packet.Nsp)
{
return;
}
switch (packet.Type)
{
case Parser.Parser.CONNECT:
this.OnConnect();
break;
case Parser.Parser.EVENT:
this.OnEvent(packet);
break;
case Parser.Parser.BINARY_EVENT:
this.OnEvent(packet);
break;
case Parser.Parser.ACK:
this.OnAck(packet);
break;
case Parser.Parser.BINARY_ACK:
this.OnAck(packet);
break;
case Parser.Parser.DISCONNECT:
this.OnDisconnect();
break;
case Parser.Parser.ERROR:
this.Emit(EVENT_ERROR, packet.Data);
break;
}
}
private void OnEvent(Packet packet)
{
var log = LogManager.GetLogger(Global.CallerName());
//var jarr =(string) ((JValue) packet.Data).Value;
//var job = JToken.Parse(jarr);
//var arr = job.ToArray();
//var args = job.Select(token => token.Value<string>()).Cast<object>().ToList();
var args = packet.GetDataAsList();
log.Info(string.Format("emitting event {0}", args));
if (packet.Id >= 0)
{
log.Info("attaching ack callback to event");
args.Add(new AckImp(this, packet.Id));
}
if (Connected)
{
var eventString = (string) args[0];
args.Remove(args[0]);
base.Emit(eventString, args.ToArray());
}
else
{
ReceiveBuffer = ReceiveBuffer.Enqueue(args);
}
}
private class AckImp : IAck
{
private Socket socket;
private int Id;
private readonly bool[] sent = new[] {false};
public AckImp(Socket socket, int id)
{
this.socket = socket;
this.Id = id;
}
public void Call(params object[] args)
{
if (sent[0])
{
return;
}
sent[0] = true;
var log = LogManager.GetLogger(Global.CallerName());
var jsonArgs = Parser.Packet.Args2JArray(args);
log.Info(string.Format("sending ack {0}", args.Length != 0 ? jsonArgs.ToString() : "null"));
var parserType = HasBinaryData.HasBinary(args) ? Parser.Parser.BINARY_ACK : Parser.Parser.ACK;
var packet = new Packet(parserType, jsonArgs);
packet.Id = Id;
socket.Packet(packet);
}
}
private void OnAck(Parser.Packet packet)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("calling ack {0} with {1}", packet.Id, packet.Data));
var fn = Acks[packet.Id];
Acks = Acks.Remove(packet.Id);
var args = packet.GetDataAsList();
fn.Call(args.ToArray());
}
private void OnConnect()
{
Connected = true;
//Disconnected = false;
Emit(EVENT_CONNECT);
EmitBuffered();
}
private void EmitBuffered()
{
while (ReceiveBuffer.Count() > 0)
{
List<object> data;
ReceiveBuffer = ReceiveBuffer.Dequeue(out data);
var eventString = (string) data[0];
base.Emit(eventString, data.ToArray());
}
ReceiveBuffer = ReceiveBuffer.Clear();
while (SendBuffer.Count() > 0)
{
Packet packet;
SendBuffer = SendBuffer.Dequeue(out packet);
Packet(packet);
}
SendBuffer = SendBuffer.Clear();
}
private void OnDisconnect()
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("server disconnect ({0})", this.Nsp));
Destroy();
OnClose("io server disconnect");
}
private void Destroy()
{
foreach (var sub in Subs)
{
sub.Destroy();
}
Subs = Subs.Clear();
_io.Destroy(this);
}
public Socket Close()
{
var log = LogManager.GetLogger(Global.CallerName());
if (Connected)
{
log.Info(string.Format("performing disconnect ({0})", Nsp));
Packet(new Packet(Parser.Parser.DISCONNECT));
}
Destroy();
if (Connected)
{
OnClose("io client disconnect");
}
return this;
}
public Socket Disconnect()
{
return this.Close();
}
public Manager Io()
{
return _io;
}
private static IEnumerable<object> ToArray(JArray array)
{
int length = array.Count;
var data = new object[length];
for (int i = 0; i < length; i++)
{
object v;
try
{
v = array[i];
}
catch (Exception)
{
v = null;
}
data[i] = v;
}
return data;
}
}
}

View File

@@ -0,0 +1,26 @@
using System;
namespace Quobject.SocketIoClientDotNet.Client
{
public class SocketIOException : Exception
{
public string Transport;
public object code;
public SocketIOException(string message)
: base(message)
{
}
public SocketIOException(Exception cause)
: base("", cause)
{
}
public SocketIOException(string message, Exception cause)
: base(message, cause)
{
}
}
}

View File

@@ -0,0 +1,413 @@

using Newtonsoft.Json.Linq;
using Quobject.SocketIoClientDotNet.Collections.Concurrent;
using Quobject.EngineIoClientDotNet.ComponentEmitter;
using Quobject.EngineIoClientDotNet.Modules;
using Quobject.SocketIoClientDotNet.Modules;
using Quobject.SocketIoClientDotNet.Parser;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Quobject.SocketIoClientDotNet.Client
{
public class Socket : Emitter
{
public static readonly string EVENT_CONNECT = "connect";
public static readonly string EVENT_DISCONNECT = "disconnect";
public static readonly string EVENT_ERROR = "error";
public static readonly string EVENT_MESSAGE = "message";
public static readonly string EVENT_CONNECT_ERROR = Manager.EVENT_CONNECT_ERROR;
public static readonly string EVENT_CONNECT_TIMEOUT = Manager.EVENT_CONNECT_TIMEOUT;
public static readonly string EVENT_RECONNECT = Manager.EVENT_RECONNECT;
public static readonly string EVENT_RECONNECT_ERROR = Manager.EVENT_RECONNECT_ERROR;
public static readonly string EVENT_RECONNECT_FAILED = Manager.EVENT_RECONNECT_FAILED;
public static readonly string EVENT_RECONNECT_ATTEMPT = Manager.EVENT_RECONNECT_ATTEMPT;
public static readonly string EVENT_RECONNECTING = Manager.EVENT_RECONNECTING;
private static readonly List<string> Events = new List<string>()
{
EVENT_CONNECT,
EVENT_CONNECT_ERROR,
EVENT_CONNECT_TIMEOUT,
EVENT_DISCONNECT,
EVENT_ERROR,
EVENT_RECONNECT,
EVENT_RECONNECT_ATTEMPT,
EVENT_RECONNECT_FAILED,
EVENT_RECONNECT_ERROR,
EVENT_RECONNECTING
};
private bool Connected;
//private bool Disconnected = true;
private int Ids;
private string Nsp;
private Manager _io;
private System.Collections.Concurrent.ConcurrentDictionary<int, IAck> Acks = new System.Collections.Concurrent.ConcurrentDictionary<int, IAck>();
private ConcurrentQueue<On.IHandle> Subs;
private ConcurrentQueue<List<object>> ReceiveBuffer = new ConcurrentQueue<List<object>>();
private ConcurrentQueue<Parser.Packet> SendBuffer = new ConcurrentQueue<Parser.Packet>();
public Socket(Manager io, string nsp)
{
_io = io;
Nsp = nsp;
this.SubEvents();
}
private void SubEvents()
{
Manager io = _io;
Subs = new ConcurrentQueue<On.IHandle>();
Subs.Enqueue(Client.On.Create(io, Manager.EVENT_OPEN, new ListenerImpl(OnOpen)));
Subs.Enqueue(Client.On.Create(io, Manager.EVENT_PACKET, new ListenerImpl((data) => OnPacket((Packet)data))));
Subs.Enqueue(Client.On.Create(io, Manager.EVENT_CLOSE, new ListenerImpl((data) => OnClose((string)data))));
}
public Socket Open()
{
Task.Run(() =>
{
if (!Connected)
{
_io.Open();
if (_io.ReadyState == Manager.ReadyStateEnum.OPEN)
{
OnOpen();
}
}
});
return this;
}
public Socket Connect()
{
return this.Open();
}
public Socket Send(params object[] args)
{
Emit(EVENT_MESSAGE, args);
return this;
}
public override Emitter Emit(string eventString, params object[] args)
{
var log = LogManager.GetLogger(Global.CallerName());
if (Events.Contains(eventString))
{
base.Emit(eventString, args);
return this;
}
var _args = new List<object> {eventString};
_args.AddRange(args);
var jsonArgs = Parser.Packet.Args2JArray(_args);
var parserType = HasBinaryData.HasBinary(jsonArgs) ? Parser.Parser.BINARY_EVENT : Parser.Parser.EVENT;
var packet = new Packet(parserType, jsonArgs);
var lastArg = _args[_args.Count - 1];
if (lastArg is IAck)
{
log.Info(string.Format("emitting packet with ack id {0}", Ids));
Acks.TryAdd(Ids, (IAck)lastArg);
jsonArgs = Parser.Packet.Remove(jsonArgs, jsonArgs.Count - 1);
packet.Data = jsonArgs;
packet.Id = Ids++;
}
if (Connected)
{
Packet(packet);
}
else
{
SendBuffer.Enqueue(packet);
}
return this;
}
public Emitter Emit(string eventString, IAck ack, params object[] args)
{
var log = LogManager.GetLogger(Global.CallerName());
var _args = new List<object> { eventString };
if (args != null)
{
_args.AddRange(args);
}
var jarray = new JArray(_args);
var packet = new Packet(Parser.Parser.EVENT, jarray);
log.Info(string.Format("emitting packet with ack id {0}", Ids));
Acks.TryAdd(Ids, ack);
packet.Id = Ids++;
Packet(packet);
return this;
}
public Emitter Emit(string eventString, Action ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public Emitter Emit(string eventString, Action<object> ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public Emitter Emit(string eventString, Action<object, object> ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public Emitter Emit(string eventString, Action<object, object, object> ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public void Packet(Packet packet)
{
packet.Nsp = Nsp;
_io.Packet(packet);
}
private void OnOpen()
{
var log = LogManager.GetLogger(Global.CallerName());
if (Nsp != "/")
{
Packet(new Packet(Parser.Parser.CONNECT));
}
}
private void OnClose(string reason)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("close ({0})", reason));
Connected = false;
Emit(EVENT_DISCONNECT, reason);
}
private void OnPacket(Packet packet)
{
if (Nsp != packet.Nsp)
{
return;
}
switch (packet.Type)
{
case Parser.Parser.CONNECT:
this.OnConnect();
break;
case Parser.Parser.EVENT:
this.OnEvent(packet);
break;
case Parser.Parser.BINARY_EVENT:
this.OnEvent(packet);
break;
case Parser.Parser.ACK:
this.OnAck(packet);
break;
case Parser.Parser.BINARY_ACK:
this.OnAck(packet);
break;
case Parser.Parser.DISCONNECT:
this.OnDisconnect();
break;
case Parser.Parser.ERROR:
this.Emit(EVENT_ERROR, packet.Data);
break;
}
}
private void OnEvent(Packet packet)
{
var log = LogManager.GetLogger(Global.CallerName());
//var jarr =(string) ((JValue) packet.Data).Value;
//var job = JToken.Parse(jarr);
//var arr = job.ToArray();
//var args = job.Select(token => token.Value<string>()).Cast<object>().ToList();
var args = packet.GetDataAsList();
log.Info(string.Format("emitting event {0}", args));
if (packet.Id >= 0)
{
log.Info("attaching ack callback to event");
args.Add(new AckImp(this, packet.Id));
}
if (Connected)
{
var eventString = (string) args[0];
args.Remove(args[0]);
base.Emit(eventString, args.ToArray());
}
else
{
ReceiveBuffer.Enqueue(args);
}
}
private class AckImp : IAck
{
private Socket socket;
private int Id;
private readonly bool[] sent = new[] {false};
public AckImp(Socket socket, int id)
{
this.socket = socket;
this.Id = id;
}
public void Call(params object[] args)
{
if (sent[0])
{
return;
}
sent[0] = true;
var log = LogManager.GetLogger(Global.CallerName());
var jsonArgs = Parser.Packet.Args2JArray(args);
log.Info(string.Format("sending ack {0}", args.Length != 0 ? jsonArgs.ToString() : "null"));
var parserType = HasBinaryData.HasBinary(args) ? Parser.Parser.BINARY_ACK : Parser.Parser.ACK;
var packet = new Packet(parserType, jsonArgs);
packet.Id = Id;
socket.Packet(packet);
}
}
private void OnAck(Parser.Packet packet)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("calling ack {0} with {1}", packet.Id, packet.Data));
var fn = Acks[packet.Id];
IAck outRef;
Acks.TryRemove(packet.Id,out outRef );
var args = packet.GetDataAsList();
fn.Call(args.ToArray());
}
private void OnConnect()
{
Connected = true;
//Disconnected = false;
Emit(EVENT_CONNECT);
EmitBuffered();
}
private void EmitBuffered()
{
while (ReceiveBuffer.Count > 0)
{
List<object> data;
ReceiveBuffer.TryDequeue(out data);
var eventString = (string) data[0];
base.Emit(eventString, data.ToArray());
}
ReceiveBuffer.Clear();
while (SendBuffer.Count > 0)
{
Packet packet;
SendBuffer.TryDequeue(out packet);
Packet(packet);
}
SendBuffer.Clear();
}
private void OnDisconnect()
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("server disconnect ({0})", this.Nsp));
Destroy();
OnClose("io server disconnect");
}
private void Destroy()
{
foreach (var sub in Subs.GetEnumerator())
{
sub.Destroy();
}
Subs.Clear();
_io.Destroy(this);
}
public Socket Close()
{
if (!Connected)
{
return this;
}
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("performing disconnect ({0})", Nsp));
Packet(new Packet(Parser.Parser.DISCONNECT));
Destroy();
OnClose("io client disconnect");
return this;
}
public Socket Disconnect()
{
return this.Close();
}
public Manager Io()
{
return _io;
}
private static IEnumerable<object> ToArray(JArray array)
{
int length = array.Count;
var data = new object[length];
for (int i = 0; i < length; i++)
{
object v;
try
{
v = array[i];
}
catch (Exception)
{
v = null;
}
data[i] = v;
}
return data;
}
}
}

View File

@@ -0,0 +1,414 @@

using Newtonsoft.Json.Linq;
using Quobject.SocketIoClientDotNet.Collections.Concurrent;
using Quobject.EngineIoClientDotNet.ComponentEmitter;
using Quobject.EngineIoClientDotNet.Modules;
using Quobject.SocketIoClientDotNet.Modules;
using Quobject.SocketIoClientDotNet.Parser;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Quobject.SocketIoClientDotNet.Client
{
public class Socket : Emitter
{
public static readonly string EVENT_CONNECT = "connect";
public static readonly string EVENT_DISCONNECT = "disconnect";
public static readonly string EVENT_ERROR = "error";
public static readonly string EVENT_MESSAGE = "message";
public static readonly string EVENT_CONNECT_ERROR = Manager.EVENT_CONNECT_ERROR;
public static readonly string EVENT_CONNECT_TIMEOUT = Manager.EVENT_CONNECT_TIMEOUT;
public static readonly string EVENT_RECONNECT = Manager.EVENT_RECONNECT;
public static readonly string EVENT_RECONNECT_ERROR = Manager.EVENT_RECONNECT_ERROR;
public static readonly string EVENT_RECONNECT_FAILED = Manager.EVENT_RECONNECT_FAILED;
public static readonly string EVENT_RECONNECT_ATTEMPT = Manager.EVENT_RECONNECT_ATTEMPT;
public static readonly string EVENT_RECONNECTING = Manager.EVENT_RECONNECTING;
private static readonly List<string> Events = new List<string>()
{
EVENT_CONNECT,
EVENT_CONNECT_ERROR,
EVENT_CONNECT_TIMEOUT,
EVENT_DISCONNECT,
EVENT_ERROR,
EVENT_RECONNECT,
EVENT_RECONNECT_ATTEMPT,
EVENT_RECONNECT_FAILED,
EVENT_RECONNECT_ERROR,
EVENT_RECONNECTING
};
private bool Connected;
//private bool Disconnected = true;
private int Ids;
private string Nsp;
private Manager _io;
private System.Collections.Concurrent.ConcurrentDictionary<int, IAck> Acks = new System.Collections.Concurrent.ConcurrentDictionary<int, IAck>();
private ConcurrentQueue<On.IHandle> Subs;
private ConcurrentQueue<List<object>> ReceiveBuffer = new ConcurrentQueue<List<object>>();
private ConcurrentQueue<Parser.Packet> SendBuffer = new ConcurrentQueue<Parser.Packet>();
public Socket(Manager io, string nsp)
{
_io = io;
Nsp = nsp;
this.SubEvents();
}
private void SubEvents()
{
Manager io = _io;
Subs = new ConcurrentQueue<On.IHandle>();
Subs.Enqueue(Client.On.Create(io, Manager.EVENT_OPEN, new ListenerImpl(OnOpen)));
Subs.Enqueue(Client.On.Create(io, Manager.EVENT_PACKET, new ListenerImpl((data) => OnPacket((Packet)data))));
Subs.Enqueue(Client.On.Create(io, Manager.EVENT_CLOSE, new ListenerImpl((data) => OnClose((string)data))));
}
public Socket Open()
{
var t = new Task(() =>
{
if (!Connected)
{
_io.Open();
if (_io.ReadyState == Manager.ReadyStateEnum.OPEN)
{
OnOpen();
}
}
});
t.Start();
return this;
}
public Socket Connect()
{
return this.Open();
}
public Socket Send(params object[] args)
{
Emit(EVENT_MESSAGE, args);
return this;
}
public override Emitter Emit(string eventString, params object[] args)
{
var log = LogManager.GetLogger(Global.CallerName());
if (Events.Contains(eventString))
{
base.Emit(eventString, args);
return this;
}
var _args = new List<object> {eventString};
_args.AddRange(args);
var jsonArgs = Parser.Packet.Args2JArray(_args);
var parserType = HasBinaryData.HasBinary(jsonArgs) ? Parser.Parser.BINARY_EVENT : Parser.Parser.EVENT;
var packet = new Packet(parserType, jsonArgs);
var lastArg = _args[_args.Count - 1];
if (lastArg is IAck)
{
log.Info(string.Format("emitting packet with ack id {0}", Ids));
Acks.TryAdd(Ids, (IAck)lastArg);
jsonArgs = Parser.Packet.Remove(jsonArgs, jsonArgs.Count - 1);
packet.Data = jsonArgs;
packet.Id = Ids++;
}
if (Connected)
{
Packet(packet);
}
else
{
SendBuffer.Enqueue(packet);
}
return this;
}
public Emitter Emit(string eventString, IAck ack, params object[] args)
{
var log = LogManager.GetLogger(Global.CallerName());
var _args = new List<object> { eventString };
if (args != null)
{
_args.AddRange(args);
}
var jarray = new JArray(_args);
var packet = new Packet(Parser.Parser.EVENT, jarray);
log.Info(string.Format("emitting packet with ack id {0}", Ids));
Acks.TryAdd(Ids, ack);
packet.Id = Ids++;
Packet(packet);
return this;
}
public Emitter Emit(string eventString, Action ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public Emitter Emit(string eventString, Action<object> ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public Emitter Emit(string eventString, Action<object, object> ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public Emitter Emit(string eventString, Action<object, object, object> ack, params object[] args)
{
return Emit(eventString, new AckImpl(ack), args);
}
public void Packet(Packet packet)
{
packet.Nsp = Nsp;
_io.Packet(packet);
}
private void OnOpen()
{
var log = LogManager.GetLogger(Global.CallerName());
if (Nsp != "/")
{
Packet(new Packet(Parser.Parser.CONNECT));
}
}
private void OnClose(string reason)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("close ({0})", reason));
Connected = false;
Emit(EVENT_DISCONNECT, reason);
}
private void OnPacket(Packet packet)
{
if (Nsp != packet.Nsp)
{
return;
}
switch (packet.Type)
{
case Parser.Parser.CONNECT:
this.OnConnect();
break;
case Parser.Parser.EVENT:
this.OnEvent(packet);
break;
case Parser.Parser.BINARY_EVENT:
this.OnEvent(packet);
break;
case Parser.Parser.ACK:
this.OnAck(packet);
break;
case Parser.Parser.BINARY_ACK:
this.OnAck(packet);
break;
case Parser.Parser.DISCONNECT:
this.OnDisconnect();
break;
case Parser.Parser.ERROR:
this.Emit(EVENT_ERROR, packet.Data);
break;
}
}
private void OnEvent(Packet packet)
{
var log = LogManager.GetLogger(Global.CallerName());
//var jarr =(string) ((JValue) packet.Data).Value;
//var job = JToken.Parse(jarr);
//var arr = job.ToArray();
//var args = job.Select(token => token.Value<string>()).Cast<object>().ToList();
var args = packet.GetDataAsList();
log.Info(string.Format("emitting event {0}", args));
if (packet.Id >= 0)
{
log.Info("attaching ack callback to event");
args.Add(new AckImp(this, packet.Id));
}
if (Connected)
{
var eventString = (string) args[0];
args.Remove(args[0]);
base.Emit(eventString, args.ToArray());
}
else
{
ReceiveBuffer.Enqueue(args);
}
}
private class AckImp : IAck
{
private Socket socket;
private int Id;
private readonly bool[] sent = new[] {false};
public AckImp(Socket socket, int id)
{
this.socket = socket;
this.Id = id;
}
public void Call(params object[] args)
{
if (sent[0])
{
return;
}
sent[0] = true;
var log = LogManager.GetLogger(Global.CallerName());
var jsonArgs = Parser.Packet.Args2JArray(args);
log.Info(string.Format("sending ack {0}", args.Length != 0 ? jsonArgs.ToString() : "null"));
var parserType = HasBinaryData.HasBinary(args) ? Parser.Parser.BINARY_ACK : Parser.Parser.ACK;
var packet = new Packet(parserType, jsonArgs);
packet.Id = Id;
socket.Packet(packet);
}
}
private void OnAck(Parser.Packet packet)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("calling ack {0} with {1}", packet.Id, packet.Data));
var fn = Acks[packet.Id];
IAck outRef;
Acks.TryRemove(packet.Id,out outRef );
var args = packet.GetDataAsList();
fn.Call(args.ToArray());
}
private void OnConnect()
{
Connected = true;
//Disconnected = false;
Emit(EVENT_CONNECT);
EmitBuffered();
}
private void EmitBuffered()
{
while (ReceiveBuffer.Count > 0)
{
List<object> data;
ReceiveBuffer.TryDequeue(out data);
var eventString = (string) data[0];
base.Emit(eventString, data.ToArray());
}
ReceiveBuffer.Clear();
while (SendBuffer.Count > 0)
{
Packet packet;
SendBuffer.TryDequeue(out packet);
Packet(packet);
}
SendBuffer.Clear();
}
private void OnDisconnect()
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("server disconnect ({0})", this.Nsp));
Destroy();
OnClose("io server disconnect");
}
private void Destroy()
{
foreach (var sub in Subs.GetEnumerator())
{
sub.Destroy();
}
Subs.Clear();
_io.Destroy(this);
}
public Socket Close()
{
if (!Connected)
{
return this;
}
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("performing disconnect ({0})", Nsp));
Packet(new Packet(Parser.Parser.DISCONNECT));
Destroy();
OnClose("io client disconnect");
return this;
}
public Socket Disconnect()
{
return this.Close();
}
public Manager Io()
{
return _io;
}
private static IEnumerable<object> ToArray(JArray array)
{
int length = array.Count;
var data = new object[length];
for (int i = 0; i < length; i++)
{
object v;
try
{
v = array[i];
}
catch (Exception)
{
v = null;
}
data[i] = v;
}
return data;
}
}
}

View File

@@ -0,0 +1,46 @@
using System;
namespace Quobject.SocketIoClientDotNet.Client
{
public class Url
{
private Url() { }
public static Uri Parse(string uri)
{
if (uri.StartsWith("//"))
{
uri = "http:" + uri;
}
var result = new Uri(uri);
return result;
}
public static string ExtractId(string url)
{
return ExtractId(new Uri(url));
}
public static string ExtractId(Uri uri)
{
var protocol = uri.Scheme;
int port = uri.Port;
if (port == -1)
{
if (uri.Scheme.StartsWith("https"))
{
port = 443;
}else if (uri.Scheme.StartsWith("http"))
{
port = 80;
}
}
return string.Format("{0}://{1}:{2}", protocol, uri.Host , port);
}
}
}

View File

@@ -0,0 +1,59 @@
using Newtonsoft.Json.Linq;
using System.Linq;
namespace Quobject.SocketIoClientDotNet.Modules
{
public static class HasBinaryData
{
public static bool HasBinary(object data)
{
return RecursiveCheckForBinary(data);
}
private static bool RecursiveCheckForBinary(object obj)
{
if (obj == null || obj is string)
{
return false;
}
if (obj is byte[])
{
return true;
}
var array = obj as JArray;
if (array != null)
{
if (array.Any(token => RecursiveCheckForBinary(token)))
{
return true;
}
}
var jobject = obj as JObject;
if (jobject != null)
{
if (jobject.Children().Any(child => RecursiveCheckForBinary(child)))
{
return true;
}
}
var jvalue = obj as JValue;
if (jvalue != null)
{
return RecursiveCheckForBinary(jvalue.Value);
}
var jprop = obj as JProperty;
if (jprop != null)
{
return RecursiveCheckForBinary(jprop.Value);
}
return false;
}
}
}

View File

@@ -0,0 +1,242 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
namespace Quobject.SocketIoClientDotNet.Parser
{
public class Binary
{
private static readonly string KEY_PLACEHOLDER = "_placeholder";
private static readonly string KEY_NUM = "num";
public static DeconstructedPacket DeconstructPacket(Packet packet)
{
var buffers = new List<byte[]>();
packet.Data = _deconstructPacket(packet.Data, buffers);
packet.Attachments = buffers.Count;
var result = new DeconstructedPacket();
result.Packet = packet;
result.Buffers = buffers.ToArray();
return result;
}
private static JToken _deconstructPacket(object data, List<byte[]> buffers)
{
if (data == null)
{
return null;
}
if (data is byte[])
{
var byteArray = (byte[])data;
return AddPlaceholder(buffers, byteArray);
}
var jToken = data as JToken;
if (jToken == null)
{
throw new NotImplementedException();
}
switch (jToken.Type)
{
case JTokenType.Object:
var newJObject = new JObject();
var jObject = (JObject)jToken;
foreach (var property in jObject.Properties())
{
try
{
newJObject[property.Name] = _deconstructPacket(property.Value, buffers);
}
catch (Exception)
{
return null;
}
}
return newJObject;
case JTokenType.Array:
var newJArray = new JArray();
var jArray = (JArray)jToken;
for (int i = 0; i < jArray.Count; i++)
{
try
{
newJArray.Add(_deconstructPacket(jArray[i], buffers));
}
catch (Exception)
{
return null;
}
}
return newJArray;
case JTokenType.Bytes:
var byteArray = jToken.Value<byte[]>();
return AddPlaceholder(buffers, byteArray);
case JTokenType.None:
case JTokenType.Constructor:
case JTokenType.Property:
case JTokenType.Comment:
throw new NotImplementedException();
default:
return jToken;
}
}
private static JToken AddPlaceholder(List<byte[]> buffers, byte[] byteArray)
{
var placeholder = new JObject();
try
{
placeholder.Add(KEY_PLACEHOLDER, true);
placeholder.Add(KEY_NUM, buffers.Count);
}
catch (Exception)
{
return null;
}
buffers.Add(byteArray);
return placeholder;
}
public static Packet ReconstructPacket(Packet packet, byte[][] buffers)
{
packet.Data = _reconstructPacket(packet.Data, buffers);
packet.Attachments = -1;
return packet;
}
private static object _reconstructPacket(object data, byte[][] buffers)
{
//var t = data.GetType();
if (data is JValue)
{
var dataStr = data.ToString();
if (!dataStr.StartsWith("[") && !dataStr.StartsWith("{"))
{
//
return dataStr;
}
var jdata = JToken.Parse(data.ToString());
if (jdata.SelectToken(KEY_PLACEHOLDER) != null)
{
var jpl = jdata[KEY_PLACEHOLDER];
var jnum = jdata[KEY_NUM];
if (jpl != null && jnum != null)
{
var placeholder = jpl.ToObject<bool>();
if (placeholder)
{
var num = jnum.ToObject<int>();
return buffers[num];
}
}
}
else
{
var recValue = _reconstructPacket(jdata, buffers);
return recValue;
}
//jdata
}else if (data is JArray)
{
var _data = (JArray)data;
int len = _data.Count;
var newData = new JArray();
for (int i = 0; i < len; i++)
{
try
{
var recValue = _reconstructPacket(_data[i], buffers);
if (recValue is string)
{
//newData[i] = (string) recValue;
newData.Add((string)recValue);
}
else if (recValue is byte[])
{
newData.Add((byte[])recValue);
}
else if (recValue is JArray)
{
//newData[i] = (JArray) recValue;
newData.Add((JArray)recValue);
}
else if (recValue is JObject)
{
//newData[i] = (JObject)recValue;
newData.Add((JObject)recValue);
}
}
catch (Exception)
{
return null;
}
}
return newData;
}
if (!(data is JObject))
{
return data;
}
var newData1 = new JObject();
var _data1 = (JObject)data;
//if ((bool) _data1[KEY_PLACEHOLDER])
if (_data1.SelectToken(KEY_PLACEHOLDER) != null && (bool) _data1[KEY_PLACEHOLDER])
{
var num = (int)_data1[KEY_NUM];
return num >= 0 && num < buffers.Length ? buffers[num] : null;
}
foreach (var property in _data1.Properties())
{
try
{
var recValue = _reconstructPacket(property.Value, buffers);
if (recValue is string)
{
newData1[property.Name] = (string)recValue;
}
else if (recValue is byte[])
{
newData1[property.Name] = (byte[])recValue;
}
else if (recValue is JArray)
{
newData1[property.Name] = (JArray)recValue;
}
else if (recValue is JObject)
{
newData1[property.Name] = (JObject)recValue;
}
}
catch (Exception)
{
return null;
}
}
return newData1;
}
public class DeconstructedPacket
{
public Packet Packet;
public byte[][] Buffers;
}
}
}

View File

@@ -0,0 +1,109 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
namespace Quobject.SocketIoClientDotNet.Parser
{
public class Packet<T>
{
public int Type = -1;
public int Id = -1;
public String Nsp;
public T Data;
public int Attachments;
public Packet() { }
public Packet(int type)
{
this.Type = type;
}
public Packet(int type, T data)
{
this.Type = type;
this.Data = data;
}
}
public class Packet
{
public int Type = -1;
public int Id = -1;
public String Nsp;
public object Data;
public int Attachments;
public Packet()
{ }
public Packet(int type)
: this(type, data: JToken.Parse("{}"))
{
}
public Packet(int type, object data)
{
this.Type = type;
this.Data = data;
}
public override string ToString()
{
return string.Format("Type:{0} Id:{1} Nsp:{2} Data:{3} Attachments:{4}", Type, Id, Nsp, Data, Attachments);
}
public List<object> GetDataAsList()
{
var jarray = Data is JArray ? (JArray)Data : JArray.Parse((string)((JValue)Data).Value);
var args = new List<object>();
foreach (var o in jarray)
{
if (o is JValue)
{
var jval = (JValue)o;
if (jval != null)
{
args.Add(jval.Value);
}
}
else if (o is JToken)
{
var jtoken = (JToken)o;
if (jtoken != null)
{
args.Add(jtoken);
//args.Add(jtoken.ToString(Formatting.None));
}
}
}
return args;
}
public static JArray Args2JArray(IEnumerable<object> _args)
{
var jsonArgs = new JArray();
foreach (var o in _args)
{
jsonArgs.Add(o);
}
return jsonArgs;
}
public static JArray Remove(JArray a, int pos)
{
var na = new JArray();
for (int i = 0; i < a.Count; i++)
{
if (i != pos)
{
var v = a[i];
na.Add(v);
}
}
return na;
}
}
}

View File

@@ -0,0 +1,323 @@
using Newtonsoft.Json.Linq;
using Quobject.EngineIoClientDotNet.ComponentEmitter;
using Quobject.EngineIoClientDotNet.Modules;
using Quobject.SocketIoClientDotNet.Client;
using System;
using System.Collections.Generic;
using System.Text;
namespace Quobject.SocketIoClientDotNet.Parser
{
public class Parser
{
public const int CONNECT = 0;
public const int DISCONNECT = 1;
public const int EVENT = 2;
public const int ACK = 3;
public const int ERROR = 4;
public const int BINARY_EVENT = 5;
public const int BINARY_ACK = 6;
public const int protocol = 4;
/// <summary>
/// Packet types
/// </summary>
public static List<string> types = new List<string>()
{
"CONNECT",
"DISCONNECT",
"EVENT",
"BINARY_EVENT",
"ACK",
"BINARY_ACK",
"ERROR"
};
private Parser() { }
private static Packet ErrorPacket = new Packet(ERROR, "parser error");
public class Encoder
{
public Encoder() { }
public interface ICallback
{
void Call(object[] data);
}
public void Encode(Packet obj, ICallback callback)
{
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("encoding packet {0}", obj));
if (BINARY_EVENT == obj.Type || BINARY_ACK == obj.Type)
{
EncodeAsBinary(obj, callback);
}
else
{
String encoding = EncodeAsString(obj);
callback.Call(new object[] { encoding });
}
}
private string EncodeAsString(Packet obj)
{
var str = new StringBuilder();
bool nsp = false;
str.Append(obj.Type);
if (BINARY_EVENT == obj.Type || BINARY_ACK == obj.Type)
{
str.Append(obj.Attachments);
str.Append("-");
}
if (!string.IsNullOrEmpty(obj.Nsp) && !"/".Equals(obj.Nsp))
{
nsp = true;
str.Append(obj.Nsp);
}
if (obj.Id >= 0)
{
if (nsp)
{
str.Append(",");
nsp = false;
}
str.Append(obj.Id);
}
if (obj.Data != null)
{
if (nsp) str.Append(",");
str.Append(obj.Data);
}
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("encoded {0} as {1}", obj, str));
return str.ToString();
}
private void EncodeAsBinary(Packet obj, ICallback callback)
{
Binary.DeconstructedPacket deconstruction = Binary.DeconstructPacket(obj);
String pack = EncodeAsString(deconstruction.Packet);
var buffers = new List<object>();
foreach (var item in deconstruction.Buffers)
{
buffers.Add(item);
}
buffers.Insert(0, pack);
callback.Call(buffers.ToArray());
}
public class CallbackImp : ICallback
{
private readonly Action<object[]> Fn;
public CallbackImp(Action<object[]> fn)
{
Fn = fn;
}
public void Call(object[] data)
{
Fn(data);
}
}
}
public class Decoder : Emitter
{
public const string EVENT_DECODED = "decoded";
/*package*/
public BinaryReconstructor Reconstructor = null;
public Decoder()
{
}
public void Add(string obj)
{
Packet packet = decodeString(obj);
if (packet.Type == BINARY_EVENT || packet.Type == BINARY_ACK)
{
this.Reconstructor = new BinaryReconstructor(packet);
if (this.Reconstructor.reconPack.Attachments == 0)
{
this.Emit(EVENT_DECODED, packet);
}
}
else
{
this.Emit(EVENT_DECODED, packet);
}
}
public void Add(byte[] obj)
{
if (this.Reconstructor == null)
{
throw new SocketIOException("got binary data when not reconstructing a packet");
}
else
{
var packet = this.Reconstructor.TakeBinaryData(obj);
if (packet != null)
{
this.Reconstructor = null;
this.Emit(EVENT_DECODED, packet);
}
}
}
private Packet decodeString(string str)
{
Packet p = new Packet();
int i = 0;
p.Type = int.Parse(str.Substring(0,1));
if (p.Type < 0 || p.Type > types.Count - 1) return ErrorPacket;
if (BINARY_EVENT == p.Type || BINARY_ACK == p.Type)
{
StringBuilder attachments = new StringBuilder();
while (str.Substring(++i, 1) != "-")
{
attachments.Append(str.Substring(i, 1));
}
p.Attachments = int.Parse(attachments.ToString());
}
if (str.Length > i + 1 && "/" == str.Substring(i+1, 1))
{
var nsp = new StringBuilder();
while (true)
{
++i;
string c = str.Substring(i, 1);
if ("," == c)
{
break;
}
nsp.Append(c);
if (i + 1 == str.Length)
{
break;
}
}
p.Nsp = nsp.ToString();
}
else
{
p.Nsp = "/";
}
var next = (i + 1) >= str.Length ? null : str.Substring(i + 1, 1);
int unused;
if (null != next && int.TryParse(next, out unused))
{
var id = new StringBuilder();
while (true)
{
++i;
var c = str.Substring(i, 1);
if (!int.TryParse(c, out unused))
{
--i;
break;
}
id.Append(c);
if (i + 1 >= str.Length)
{
break;
}
}
p.Id = int.Parse(id.ToString());
}
if (i++ < str.Length)
{
try
{
var t = str.Substring(i);
p.Data = new JValue(t);
}
catch (ArgumentOutOfRangeException)
{
// do nothing
}
catch (Exception)
{
return ErrorPacket;
}
}
var log = LogManager.GetLogger(Global.CallerName());
log.Info(string.Format("decoded {0} as {1}", str, p));
return p;
}
public void Destroy()
{
if (Reconstructor != null)
{
Reconstructor.FinishReconstruction();
}
}
}
/*package*/
public class BinaryReconstructor
{
public Packet reconPack;
/*package*/
public List<byte[]> Buffers;
public BinaryReconstructor(Packet packet)
{
this.reconPack = packet;
this.Buffers = new List<byte[]>();
}
public Packet TakeBinaryData(byte[] binData)
{
this.Buffers.Add(binData);
if (this.Buffers.Count == this.reconPack.Attachments)
{
Packet packet = Binary.ReconstructPacket(this.reconPack,
this.Buffers.ToArray());
this.FinishReconstruction();
return packet;
}
return null;
}
public void FinishReconstruction()
{
this.reconPack = null;
this.Buffers = new List<byte[]>();
}
}
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SocketIoClientDotNet")]
[assembly: AssemblyDescription("Socket.IO Client Library for .Net")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quobject Software")]
[assembly: AssemblyProduct("SocketIoClientDotNet")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a95e75cd-35e6-4e88-9e22-631e3fd01546")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5")]
[assembly: AssemblyFileVersion("1.0.5")]

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B4C79CEE-4B09-428A-BFE9-B276DF4F57FA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Quobject.SocketIoClientDotNet</RootNamespace>
<AssemblyName>SocketIoClientDotNet</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\net45\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EngineIoClientDotNet, Version=1.0.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\EngineIoClientDotNet.1.0.5\lib\net45\EngineIoClientDotNet.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SuperSocket.ClientEngine, Version=0.9.0.0, Culture=neutral, PublicKeyToken=ee9af13f57f00acc, processorArchitecture=MSIL">
<HintPath>packages\SuperSocket.ClientEngine.Core.0.9.0\lib\net45\SuperSocket.ClientEngine.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\System.Collections.Immutable.1.4.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="WebSocket4Net, Version=0.15.1.10, Culture=neutral, PublicKeyToken=eb4e154b696bf72a, processorArchitecture=MSIL">
<HintPath>packages\WebSocket4Net.0.15.1\lib\net45\WebSocket4Net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Client\AckImpl.cs" />
<Compile Include="Client\IAck.cs" />
<Compile Include="Client\IO.cs" />
<Compile Include="Client\Manager.cs" />
<Compile Include="Client\On.cs" />
<Compile Include="Client\Socket.cs" />
<Compile Include="Client\SocketIOException.cs" />
<Compile Include="Client\Url.cs" />
<Compile Include="Modules\HasBinaryData.cs" />
<Compile Include="Parser\Binary.cs" />
<Compile Include="Parser\Packet.cs" />
<Compile Include="Parser\Parser.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,78 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketIoClientDotNet.net45", "SocketIoClientDotNet.net45.csproj", "{B4C79CEE-4B09-428A-BFE9-B276DF4F57FA}"
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "grunt", "http://localhost:26409", "{78CADA8C-D36D-4887-8E24-665058A9D81A}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Debug.AspNetCompiler.VirtualPath = "/localhost_26409"
Debug.AspNetCompiler.PhysicalPath = "..\..\grunt\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26409\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_26409"
Release.AspNetCompiler.PhysicalPath = "..\..\grunt\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26409\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "..\..\grunt\"
EndProjectSection
EndProject
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "TestServer", "http://localhost:26412", "{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}"
ProjectSection(WebsiteProperties) = preProject
UseIISExpress = "true"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.0"
Debug.AspNetCompiler.VirtualPath = "/localhost_26412"
Debug.AspNetCompiler.PhysicalPath = "..\..\TestServer\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26412\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/localhost_26412"
Release.AspNetCompiler.PhysicalPath = "..\..\TestServer\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\localhost_26412\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
SlnRelativePath = "..\..\TestServer\"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketIoClientDotNet.Tests.net45", "..\SocketIoClientDotNet.Tests.net45\SocketIoClientDotNet.Tests.net45.csproj", "{EE298060-EB11-4787-804E-A1CB7EB2F597}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B4C79CEE-4B09-428A-BFE9-B276DF4F57FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4C79CEE-4B09-428A-BFE9-B276DF4F57FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4C79CEE-4B09-428A-BFE9-B276DF4F57FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4C79CEE-4B09-428A-BFE9-B276DF4F57FA}.Release|Any CPU.Build.0 = Release|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{78CADA8C-D36D-4887-8E24-665058A9D81A}.Release|Any CPU.Build.0 = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{7EF7CD07-6799-4D20-B19F-DD7CE58B5E30}.Release|Any CPU.Build.0 = Debug|Any CPU
{EE298060-EB11-4787-804E-A1CB7EB2F597}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE298060-EB11-4787-804E-A1CB7EB2F597}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE298060-EB11-4787-804E-A1CB7EB2F597}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE298060-EB11-4787-804E-A1CB7EB2F597}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,8 @@
<ProjectConfiguration>
<Settings>
<IgnoredTests>
<AllTestsSelector />
</IgnoredTests>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>

View File

@@ -0,0 +1,6 @@
<SolutionConfiguration>
<Settings>
<AllowParallelTestExecution>False</AllowParallelTestExecution>
<SolutionConfigured>True</SolutionConfigured>
</Settings>
</SolutionConfiguration>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebSocket4Net" publicKeyToken="eb4e154b696bf72a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-0.11.0.0" newVersion="0.11.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EngineIoClientDotNet" version="1.0.5" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="SuperSocket.ClientEngine.Core" version="0.9.0" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.4.0" targetFramework="net45" />
<package id="WebSocket4Net" version="0.15.1" targetFramework="net45" />
</packages>

View File

@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<RootNamespace>Quobject.SocketIoClientDotNet</RootNamespace>
<AssemblyName>SocketIoClientDotNet</AssemblyName>
<AssemblyVersion>1.0.5.0</AssemblyVersion>
<FileVersion>1.0.5.0</FileVersion>
<Version>1.0.5</Version>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\SocketIoClientDotNet.net45\Client\AckImpl.cs" Link="Client\AckImpl.cs" />
<Compile Include="..\SocketIoClientDotNet.net45\Client\IAck.cs" Link="Client\IAck.cs" />
<Compile Include="..\SocketIoClientDotNet.net45\Client\IO.cs" Link="Client\IO.cs" />
<Compile Include="..\SocketIoClientDotNet.net45\Client\Manager.cs" Link="Client\Manager.cs" />
<Compile Include="..\SocketIoClientDotNet.net45\Client\On.cs" Link="Client\On.cs" />
<Compile Include="..\SocketIoClientDotNet.net45\Client\Socket.cs" Link="Client\Socket.cs" />
<Compile Include="..\SocketIoClientDotNet.net45\Client\SocketIOException.cs" Link="Client\SocketIOException.cs" />
<Compile Include="..\SocketIoClientDotNet.net45\Client\Url.cs" Link="Client\Url.cs" />
<Compile Include="..\SocketIoClientDotNet.net45\Modules\HasBinaryData.cs" Link="Modules\HasBinaryData.cs" />
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Binary.cs" Link="Parser\Binary.cs" />
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Packet.cs" Link="Parser\Packet.cs" />
<Compile Include="..\SocketIoClientDotNet.net45\Parser\Parser.cs" Link="Parser\Parser.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EngineIoClientDotNet" Version="1.0.5" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="System.Collections.Immutable" Version="1.4.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Client\" />
<Folder Include="Parser\" />
<Folder Include="Modules\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketIoClientDotNet.netstandard1.3", "SocketIoClientDotNet.netstandard1.3.csproj", "{C8597B7D-FB47-4E8C-B6CC-F6A1A7EB4A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SocketIoClientDotNet.Tests.netstandard1.3", "..\SocketIoClientDotNet.Tests.netstandard1.3\SocketIoClientDotNet.Tests.netstandard1.3.csproj", "{8C547F34-1594-4185-85CC-2FAB00867912}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C8597B7D-FB47-4E8C-B6CC-F6A1A7EB4A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8597B7D-FB47-4E8C-B6CC-F6A1A7EB4A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8597B7D-FB47-4E8C-B6CC-F6A1A7EB4A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8597B7D-FB47-4E8C-B6CC-F6A1A7EB4A66}.Release|Any CPU.Build.0 = Release|Any CPU
{8C547F34-1594-4185-85CC-2FAB00867912}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C547F34-1594-4185-85CC-2FAB00867912}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C547F34-1594-4185-85CC-2FAB00867912}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C547F34-1594-4185-85CC-2FAB00867912}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,8 @@
<ProjectConfiguration>
<Settings>
<IgnoredTests>
<AllTestsSelector />
</IgnoredTests>
<PreviouslyBuiltSuccessfully>True</PreviouslyBuiltSuccessfully>
</Settings>
</ProjectConfiguration>

View File

@@ -0,0 +1,6 @@
<SolutionConfiguration>
<Settings>
<AllowParallelTestExecution>False</AllowParallelTestExecution>
<SolutionConfigured>True</SolutionConfigured>
</Settings>
</SolutionConfiguration>

View File

@@ -0,0 +1,2 @@
node_modules
test.xml

View File

@@ -0,0 +1,16 @@
{
"node": true,
"devel": true,
"indent": 2,
"maxerr": 50,
"newcap": true,
"nomen": true,
"plusplus": false,
"regexp": true,
"white": false,
"curly": true,
"eqnull": true,
"eqeqeq": true,
"undef": true
}

View File

@@ -0,0 +1,35 @@
<!doctype html>
<html>
<head>
<title>Socket.IO chat</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font: 13px Helvetica, Arial; }
form { background: #000; padding: 3px; position: fixed; bottom: 0; width: 100%; }
form input { border: 0; padding: 10px; width: 90%; margin-right: .5%; }
form button { width: 9%; background: rgb(130, 224, 255); border: none; padding: 10px; }
#messages { list-style-type: none; margin: 0; padding: 0; }
#messages li { padding: 5px 10px; }
#messages li:nth-child(odd) { background: #eee; }
</style>
</head>
<body>
<ul id="messages"></ul>
<form action="">
<input id="m" autocomplete="off" /><button>Send</button>
</form>
<script src="/socket.io/socket.io.js"></script>
<script src="http://code.jquery.com/jquery-1.11.1.js"></script>
<script>
var socket = io();
$('form').submit(function(){
socket.emit('chat message', $('#m').val());
$('#m').val('');
return false;
});
socket.on('chat message', function(msg){
$('#messages').append($('<li>').text(msg));
});
</script>
</body>
</html>

View File

@@ -0,0 +1,12 @@
{
"name": "socket.io-client.testserver",
"version": "0.0.0",
"private": true,
"dependencies": {
"express": "^4.15.2",
"socket.io": "^1.7.3",
"expect": "^1.20.2",
"expect.js": "^0.3.1",
"utf8": "^2.1.2"
}
}

View File

@@ -0,0 +1,216 @@
var
ssl = true,
express = require('express'),
expect = require('expect.js'),
util = require('util'),
config = require('./../grunt/config.json'),
test_data = require('./test_data.json'),
utf8 = require('utf8'),
app = express(),
fs = require('fs'),
options = {
key: fs.readFileSync(__dirname + '/testme.quobject.com.key'),
cert: fs.readFileSync(__dirname + '/testme.quobject.com.cert'),
requestCert: true
},
io,
io_ssl,
https,
http,
slice = Array.prototype.slice;
console.log("https port = " + config.server.ssl_port);
https = require('https').createServer(options, app);
io_ssl = require('socket.io')(https, { pingInterval: 500 });
https.listen(config.server.ssl_port, function (d) {
console.log('socket.io server listening on port', config.server.ssl_port);
});
console.log("http port = " + config.server.port);
http = require('http').createServer(app);
io = require('socket.io')(http, { pingInterval: 500 });
http.listen(config.server.port, function () {
console.log('socket.io server listening on port', config.server.port);
});
app.get('/', function (req, res) {
res.sendfile('index.html');
});
io.on('connection', function(socket) {
socket.emit('hi', 'more data');
socket.on('hi2', function(d) {
console.log("hi2" + d);
socket.emit('hi2back', 'more data');
});
// simple test
socket.on('hi', function(d) {
console.log("hi" + d);
socket.emit('hi', 'more data');
});
//ogs test
socket.on('parser_error#21', function(d) {
console.log("ogs test" + d);
socket.emit('parser_error#21_response', test_data.ogstestchars);
});
socket.on('d10000chars', function() {
console.log('d10000chars');
socket.emit('d10000chars', test_data.d10000chars);
});
socket.on('d100000chars', function() {
console.log('d100000chars');
socket.emit('d100000chars', test_data.d100000chars);
});
socket.on('json10000chars', function() {
console.log('json10000chars');
socket.emit('json10000chars', { data: test_data.d10000chars });
});
socket.on('json10000000chars', function() {
console.log('json10000000chars');
socket.emit('json10000000chars', {
data: test_data.d10000000chars,
data2: test_data.d100000chars,
data3: test_data.d100000chars,
data4: { data5: test_data.d100000chars }
});
});
socket.on('latin', function(wsinput) {
console.log('issue24 socket.on latin');
socket.emit('latin', { 'error': 'Nombre de usuario o contraseña incorrecta.' });
});
socket.on('nolatin', function(wsinput) {
console.log('issue24 sockect.on no latin');
socket.emit('nolatin', { 'error': 'Nombre de usuario o contrasena incorrecta.' });
});
socket.on('get_cookie', function() {
console.log(util.inspect(socket.handshake.headers.cookie));
socket.emit('got_cookie', socket.handshake.headers.cookie);
});
// ack tests
socket.on('ack', function() {
socket.emit('ack', function(a, b) {
console.log("emit ack b=" + JSON.stringify(b));
if (a === 5 && b.b === true) {
socket.emit('got it');
}
});
});
socket.on('ack2', function() {
socket.emit('ack2', 'hello there', function(a, b) {
console.log("emit ack2 b=" + JSON.stringify(b));
if (a === 5 && b.b === true) {
socket.emit('got it');
}
});
});
socket.on('getAckDate', function(data, cb) {
cb(new Date(), 5);
});
socket.on('getDate', function() {
socket.emit('takeDate', new Date());
});
socket.on('getDateObj', function() {
socket.emit('takeDateObj', { date: new Date() });
});
socket.on('getUtf8', function() {
socket.emit('takeUtf8', 'てすと');
socket.emit('takeUtf8', 'Я Б Г Д Ж Й');
socket.emit('takeUtf8', 'Ä ä Ü ü ß');
socket.emit('takeUtf8', '李O四');
socket.emit('takeUtf8', 'utf8 — string');
});
// false test
socket.on('false', function() {
socket.emit('false', false);
});
// binary test
socket.on('doge', function() {
var buf = new Buffer('asdfasdf', 'utf8');
socket.emit('doge', buf);
});
// expect receiving binary to be buffer
socket.on('buffa', function(a) {
if (Buffer.isBuffer(a)) {
socket.emit('buffack');
}
});
// expect receiving binary with mixed JSON
socket.on('jsonbuff', function(a) {
expect(a.hello).to.eql('lol');
expect(Buffer.isBuffer(a.message)).to.be(true);
expect(a.goodbye).to.eql('gotcha');
socket.emit('jsonbuff-ack');
});
// expect receiving buffers in order
var receivedAbuff1 = false;
socket.on('abuff1', function(a) {
expect(Buffer.isBuffer(a)).to.be(true);
receivedAbuff1 = true;
});
socket.on('abuff2', function(a) {
expect(receivedAbuff1).to.be(true);
socket.emit('abuff2-ack');
});
// emit buffer to base64 receiving browsers
socket.on('getbin', function() {
var buf = new Buffer('asdfasdf', 'utf8');
socket.emit('takebin', buf);
});
// simple test
socket.on('test', function(d) {
var s1 = "test" + d;
console.log(s1);
fs.appendFileSync('test.txt', s1);
socket.emit('hi', 'more data');
});
});
io.of('/foo').on('connection', function () {
// register namespace
});
io.of('/timeout_socket').on('connection', function () {
// register namespace
});
io.of('/valid').on('connection', function () {
// register namespace
});
io.of('/asd').on('connection', function () {
// register namespace
});
io_ssl.on('connection', function (socket) {
});

View File

@@ -0,0 +1 @@
testcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקהtestcsdataてすとבדיקה

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDDzCCAfegAwIBAgIJANW6WUwZpQs+MA0GCSqGSIb3DQEBBQUAMB4xHDAaBgNV
BAMME3Rlc3RtZS5xdW9iamVjdC5jb20wHhcNMTQwODI2MTkwMDQzWhcNMjQwODIz
MTkwMDQzWjAeMRwwGgYDVQQDDBN0ZXN0bWUucXVvYmplY3QuY29tMIIBIjANBgkq
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtJCU+74bnPPYg0SPBCws1WYdT7+lXDaf
IZdCLXU3RT/hAszD/Hi8oCijD1BvfjRcPr9XAqKBWMeLTorV8YL/I5g+5Nzmcaep
LjnmQV3YDR+ioBfx+PRwF8gx/ZGdmK/hcoFq27xbF6cLI4mbvddlwUdKEGgZ+g/a
B+CzFF9xCKoll6zqnnHS+DImGNbH4+ex33vQj4yoQrRT5E85s7/nSwvbDve+AlJ3
ChJVod4kepwixhV90ENP0u65lpgi7ipIDCNxtf/7ZazsSj33eSKioz3xy2mFX7WO
Fqtg1f3h/njH4uI6RkPUbuFyj3IOqv6OQwbl7NXbzuPfkmGC7QBGqwIDAQABo1Aw
TjAdBgNVHQ4EFgQUE28o7tGA1Aw53KhiC0PyTDlA29EwHwYDVR0jBBgwFoAUE28o
7tGA1Aw53KhiC0PyTDlA29EwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOC
AQEAqbOxXwelUcV9psZl8fr+FIbkl5/mLqZV1RdrHCkUD2OwGH5M8AlCqj42hmxi
n6KIgE45MOo9UYHWNQ1Aem3ziEGPRDVZpsoNW1GfG6XnAH5r1DK34Td7lU1JebNN
hxqV3AfVfeqrW1ZOmqEFJ95VwCoN1RPPh3MgFI1zjOjEJyk0pPxFNFRtpIHfLgve
TFe88aVMAbDLVzGyDkkS2DxNvyZ5153W3JRh2u8PqhLSzCIGF+IcCOrwZya+VC63
wWg8AckPXIGmhU/6P4zdQ/WCZ/tqErFYls49zwp6xAfvvfdTbqYCSNyOqsTKbYyP
qAd5L9YKITYYa8IupRyIJGbXnw==
-----END CERTIFICATE-----

View File

@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAtJCU+74bnPPYg0SPBCws1WYdT7+lXDafIZdCLXU3RT/hAszD
/Hi8oCijD1BvfjRcPr9XAqKBWMeLTorV8YL/I5g+5NzmcaepLjnmQV3YDR+ioBfx
+PRwF8gx/ZGdmK/hcoFq27xbF6cLI4mbvddlwUdKEGgZ+g/aB+CzFF9xCKoll6zq
nnHS+DImGNbH4+ex33vQj4yoQrRT5E85s7/nSwvbDve+AlJ3ChJVod4kepwixhV9
0ENP0u65lpgi7ipIDCNxtf/7ZazsSj33eSKioz3xy2mFX7WOFqtg1f3h/njH4uI6
RkPUbuFyj3IOqv6OQwbl7NXbzuPfkmGC7QBGqwIDAQABAoIBAQCy2/0YGUqVAF7a
ONFKGtAWWt5yHq6YV2ruBT0CdnfXWt1yvo7sylReeaJ8CvtGEmvFpBd2fq6N2Ku/
k3s1jsNY6Ph0D/UdZC0Lo0LYQTNAXLPkzZNdPhTDGgWa3eE0XBSALn5BR6UcGtXH
0Am71V/wQsO02MnSkF0zLHt3lMsM/oPoJx8S6Tw+PpxGOhwQipdLMjKH49vyy5IM
pS5OiGuAjmIq7bB0QPbgeZkQgSVgvZ+XP4OLuRt7I6GwMnChrVucybYWuetTSoUI
uyRmOtlwUFBVJdSwEY5RfdF71kOH9DPpuTY6M4UJGdprEM1N1dX0WF2y/5D+ExeA
rb06SXrxAoGBANfSja+YFn5+M8N/favt2/nGP6ePQJutjeiz0PgYOpe/85MrqNK/
5rlU89QNDm616xEJnsPO/J/ZFDf+2rhuTfNCeNtzA/10j07xhHYN62Us9S5bsaXC
JSMgdLcAnbUAXRJVrxPoUYgIoJIR65IG9UAHshoAysGPfBKQqR4hWKsHAoGBANYt
wMnPA2sZH651pIe9lMETHeY5AIx7QGEDtu12raTgHaQanJFTXz5oXsEkJYUJKVvK
XS2I74ZbIjvruASj2Tf7/L21xxo2JmxJCXVMlgyrVRKBIb9d0Ea7tUqLsIukYV3X
iXrSabVtLLJA/SCtZME0tHrc/4RJwLIG0XVltMo9AoGARrQl0qbCh8IUdzFnHFIa
RKOb6urVQasD2H5AMWbOmzQ5ObeN4S0ZCxI3pvp4BfD3B2fdaUyAGmXlZ8rIIK+S
PeVC7rGpVvk+kaAxwvMgcM7fq8ZCVolZ3T4evm0nPUrXMtB7QMxVGXmqEPBp+jbp
VYav5DDqO6sj/HkDzmkiQTUCgYEAxXMUonfITPmybWFjNwidlImNLOssCFav+UA1
aiHY34EFkn4+DPPxgFUz1Zb/R/A0Qr0CvbHaL+DgZKFg2lY7MROL41Erpox5S6bh
o1PhmPhyy0Zk2Ekic7Mk5P522aXHZX4I7kQA1BM7+3FSasevdTajlAkdPtXHYdhL
TZFf5HkCgYB4qGARdPa0JJ+YbNilsykkIKs602Faen7qR1uVYFzbM+GUOjMrHkxt
mmLE4+IrkhrWKQTW4vDAlIvTBZYJYeXZtu0IRilKccSExcKDhBmWhIDyFqRoyl3V
OYmrskNT5YtBTEFKerAOKJ5LXxVQQ7k2YDz3uSli3NNsCMpfqo7Lxg==
-----END RSA PRIVATE KEY-----

Binary file not shown.

View File

@@ -0,0 +1,2 @@
node_modules
test.xml

View File

@@ -0,0 +1,16 @@
{
"node": true,
"devel": true,
"indent": 2,
"maxerr": 50,
"newcap": true,
"nomen": true,
"plusplus": false,
"regexp": true,
"white": false,
"curly": true,
"eqnull": true,
"eqeqeq": true,
"undef": true
}

View File

@@ -0,0 +1,80 @@
module.exports = function (grunt) {
var
node_os = require('os'),
config = require('./config.json'),
util = require('util'),
os = node_os.platform() === 'win32' ? 'win' : 'linux',
nuget_builds = [
{ "Name": "SocketIoClientDotNet.net35", "NuGetDir": "net35", "SourceDir": "net35", copyOnly: true },
{ "Name": "SocketIoClientDotNet.net40", "NuGetDir": "net40", "SourceDir": "net40", copyOnly: true },
{ "Name": "SocketIoClientDotNet.net45", "NuGetDir": "net45", "SourceDir": "net45", copyOnly: true },
{ "Name": "SocketIoClientDotNet.netstandard1.3", "NuGetDir": "netstandard1.3", "SourceDir": "netstandard1.3", "SourceFileName": "SocketIoClientDotNet.netstandard1.3.dll", copyOnly: true },
];
grunt.log.writeln(util.inspect(config));
grunt.log.writeln( 'os = "%s"', os );
grunt.loadTasks('./tasks');
grunt.initConfig({
os: os,
config: config,
//msbuild_configuration: 'Debug',
msbuild_configuration: 'Release',
nuget_builds: nuget_builds,
release_path: './../Releases/<%= config.version %>/',
working_path: './../Working/',
server_path: '../TestServer/',
shell: {
exec: {
options: {
stdout: true,
stderr: true
}
}
},
jshint: {
options: {
jshintrc: true,
},
target: ['Gruntfile.js', '<%= server_path %>server.js', 'tasks/**/*.js']
},
clean: {
release: ['<%= release_path %>/*'],
working: ['<%= working_path %>/*'],
options: { force: true }
},
copy: {
release: {
files: [
{
expand: true,
cwd: './../SocketIoClientDotNet/bin/Release',
src: '*',
dest: '<%= release_path %>/net45'
}
]
},
release_mono: {
files: [
{
expand: true,
cwd: './../SocketIoClientDotNet_Mono/bin/Release',
src: '*',
dest: '<%= release_path %>/mono'
}
]
},
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('default', ['jshint', 'installNpm', 'nuget', 'buildClient', 'buildTest', 'startServer', 'testClient']);
grunt.registerTask('test', ['jshint', 'buildClient', 'buildTest', 'testClient']);
grunt.registerTask('makeNuget', ['jshint','clean:working','createNugetPackage']);
grunt.registerTask('makeComponent', ['jshint','clean:working','createNugetPackage','createXamarinComponent']);
};

View File

@@ -0,0 +1,20 @@
{
"version":"1.0.5",
"server":{
"port":80,
"ssl_port":443,
"hostname":"127.0.0.1"
},
"win":{
"powershell":"C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe",
"msbuild":"C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe",
"xunit_path":"C:/Development/quobject.visualstudio.com/EngineIoClientDotNet/Src/EngineIoClientDotNet.net45/packages/xunit.runner.console.2.0.0/tools",
"nuget":"C:/ProgramData/chocolatey/bin/NuGet.exe",
"xamarin_component":"xamarin-component.exe"
},
"linux":{
"msbuild":"xbuild",
"xunit_path":"/home/apollo/vendors/xunit",
"xamarin_component":"xamarin-component"
}
}

Some files were not shown because too many files have changed in this diff Show More