[修改]1. 修改命名空间和程序集

This commit is contained in:
AlianBlank 2024-07-04 14:27:50 +08:00
parent de9394e83f
commit 7ed48e3087
429 changed files with 6231 additions and 28222 deletions

3
.gitignore vendored
View File

@ -11,4 +11,5 @@ _ReSharper.*
*.nupkg
*.snupkg
test/SuperSocket.Benchmarks/BenchmarkDotNet.Artifacts
e2e
e2e
.idea

View File

@ -1,13 +0,0 @@
language: csharp
mono: none
dotnet: 3.1.100
sudo: required
script:
- dotnet build
- cd samples
- dotnet build
- cd ../test/Test
- dotnet test
global:
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
- DOTNET_CLI_TELEMETRY_OPTOUT=1

29
.vscode/launch.json vendored
View File

@ -1,29 +0,0 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceRoot}/test/Test/bin/Debug/net7.0/Test.dll",
"args": [],
"cwd": "${workspaceRoot}/test/Test",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}

View File

@ -1,3 +0,0 @@
{
"dotnet.defaultSolution": "SuperSocket.sln"
}

23
.vscode/tasks.json vendored
View File

@ -1,23 +0,0 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"options": {
"cwd": "${workspaceRoot}/src/SuperSocket.Server"
},
"tasks": [
{
"label": "build",
"type": "shell",
"command": "dotnet",
"args": [
"build"
],
"problemMatcher": "$msCompile",
"group": "build"
}
]
}

View File

@ -1,20 +0,0 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"options": {
"cwd": "${workspaceRoot}/src/SuperSocket.Server"
},
"tasks": [
{
"taskName": "build",
"args": [ ],
"isBuildCommand": true,
"showOutput": "silent",
"problemMatcher": "$msCompile"
}
]
}

View File

@ -1,28 +1,48 @@
<Project>
<Import Project="Dependencies.props" />
<PropertyGroup>
<LangVersion>10.0</LangVersion>
<TargetFrameworks>netstandard2.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
<SamplesTargetFrameworks>net7.0</SamplesTargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<MobileTargetFrameworks>net7.0-ios;net7.0-android;net7.0-macos;net7.0-tvos;net8.0-ios;net8.0-android;net8.0-macos;net8.0-tvos</MobileTargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<PackageProjectUrl>https://github.com/kerryjiang/supersocket</PackageProjectUrl>
<RepositoryUrl>https://github.com/kerryjiang/SuperSocket.git</RepositoryUrl>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IncludeSource>true</IncludeSource>
<Authors>Kerry Jiang and other contributors</Authors>
<Owners>Kerry Jiang</Owners>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup Condition="$(IsPackable) != False AND '$(OutputType)' != 'Exe'">
<Compile Include="..\..\InternalsVisibleTo.cs" />
</ItemGroup>
<PropertyGroup>
<LangVersion>10.0</LangVersion>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<Version>1.0.1</Version>
</PropertyGroup>
<PropertyGroup>
<PackageProjectUrl>https://github.com/alianblank/supersocket</PackageProjectUrl>
<RepositoryUrl>https://github.com/alianblank/SuperSocket.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageTags>GameFrameX,Lib,Extension,Server,GameServer,SuperSocket</PackageTags>
<PackageReleaseNotes>https://gameframex.doc.alianblank.com/</PackageReleaseNotes>
<PackageReadmeFile>README.md</PackageReadmeFile>
<IsPackable>true</IsPackable>
<PackageIcon>logo.png</PackageIcon>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>$(AssemblyName)</PackageId>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IncludeSource>true</IncludeSource>
<Authors>Kerry Jiang and other contributors;AlianBlank</Authors>
<Owners>Kerry Jiang;AlianBlank</Owners>
<Copyright>Kerry Jiang;AlianBlank;GameFrameX;Blank</Copyright>
<Title>$(AssemblyName)</Title>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup>
<None Include="../../logo.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
<Link>logo.png</Link>
</None>
<None Include="../../README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -5,39 +5,33 @@ VisualStudioVersion = 17.0.31612.314
MinimumVisualStudioVersion = 15.0.26124.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{DDA4741E-097F-40C3-A252-2E1E3476C1A7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Primitives", "src\SuperSocket.Primitives\SuperSocket.Primitives.csproj", "{A1317CCC-70F4-4F32-84DE-2AAF68E346D2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameFrameX.SuperSocket.Primitives", "src\GameFrameX.SuperSocket.Primitives\GameFrameX.SuperSocket.Primitives.csproj", "{A1317CCC-70F4-4F32-84DE-2AAF68E346D2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.ProtoBase", "src\SuperSocket.ProtoBase\SuperSocket.ProtoBase.csproj", "{7EE705BE-5645-451B-B5A2-50408F63A222}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameFrameX.SuperSocket.ProtoBase", "src\GameFrameX.SuperSocket.ProtoBase\GameFrameX.SuperSocket.ProtoBase.csproj", "{7EE705BE-5645-451B-B5A2-50408F63A222}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Server", "src\SuperSocket.Server\SuperSocket.Server.csproj", "{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameFrameX.SuperSocket.Client", "src\GameFrameX.SuperSocket.Client\GameFrameX.SuperSocket.Client.csproj", "{E9B31C8C-EC67-486B-9972-F6B4452BF050}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{4040EEC4-6FB7-47B1-B487-23E043A0F52F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameFrameX.SuperSocket.Command", "src\GameFrameX.SuperSocket.Command\GameFrameX.SuperSocket.Command.csproj", "{E1C29FC7-8A20-4811-94A5-0B80F1632E9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Tests", "test\SuperSocket.Tests\SuperSocket.Tests.csproj", "{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameFrameX.SuperSocket.WebSocket", "src\GameFrameX.SuperSocket.WebSocket\GameFrameX.SuperSocket.WebSocket.csproj", "{D648690B-1D08-4B8D-A299-681938B128F2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Client", "src\SuperSocket.Client\SuperSocket.Client.csproj", "{E9B31C8C-EC67-486B-9972-F6B4452BF050}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameFrameX.SuperSocket.WebSocket.Server", "src\GameFrameX.SuperSocket.WebSocket.Server\GameFrameX.SuperSocket.WebSocket.Server.csproj", "{4E9A4A13-0F74-4325-803A-351447336859}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Command", "src\SuperSocket.Command\SuperSocket.Command.csproj", "{E1C29FC7-8A20-4811-94A5-0B80F1632E9D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameFrameX.SuperSocket.Client.Proxy", "src\GameFrameX.SuperSocket.Client.Proxy\GameFrameX.SuperSocket.Client.Proxy.csproj", "{62BC2056-F454-4E7A-86E5-1C2E866145AB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.WebSocket", "src\SuperSocket.WebSocket\SuperSocket.WebSocket.csproj", "{D648690B-1D08-4B8D-A299-681938B128F2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameFrameX.SuperSocket.Http", "src\GameFrameX.SuperSocket.Http\GameFrameX.SuperSocket.Http.csproj", "{1C563726-BBB3-4D2D-B426-6C1A72A5B959}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.WebSocket.Server", "src\SuperSocket.WebSocket.Server\SuperSocket.WebSocket.Server.csproj", "{4E9A4A13-0F74-4325-803A-351447336859}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GameFrameX.SuperSocket.Udp", "src\GameFrameX.SuperSocket.Udp\GameFrameX.SuperSocket.Udp.csproj", "{695AA5D6-62C6-4D7E-8023-967CF134E26C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Client.Proxy", "src\SuperSocket.Client.Proxy\SuperSocket.Client.Proxy.csproj", "{62BC2056-F454-4E7A-86E5-1C2E866145AB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameFrameX.SuperSocket.Server.Abstractions", "src\GameFrameX.SuperSocket.Server.Abstractions\GameFrameX.SuperSocket.Server.Abstractions.csproj", "{8454E8D5-777D-46CB-B050-76C5119B624B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Tests.Command", "test\SuperSocket.Tests.Command\SuperSocket.Tests.Command.csproj", "{A68F2204-5021-4657-AACC-971FEBA385EB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameFrameX.SuperSocket.Connection", "src\GameFrameX.SuperSocket.Connection\GameFrameX.SuperSocket.Connection.csproj", "{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Http", "src\SuperSocket.Http\SuperSocket.Http.csproj", "{1C563726-BBB3-4D2D-B426-6C1A72A5B959}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameFrameX.SuperSocket.Kestrel", "src\GameFrameX.SuperSocket.Kestrel\GameFrameX.SuperSocket.Kestrel.csproj", "{8C8507D6-903F-4786-8F18-ACA54257454B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Benchmarks", "test\SuperSocket.Benchmarks\SuperSocket.Benchmarks.csproj", "{4DFB226C-2D1A-4346-B984-468A523209AF}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameFrameX.SuperSocket.ClientEngine", "src\GameFrameX.SuperSocket.ClientEngine\GameFrameX.SuperSocket.ClientEngine.csproj", "{1E6262B5-2120-415E-889C-F3477D7800B0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SuperSocket.Udp", "src\SuperSocket.Udp\SuperSocket.Udp.csproj", "{695AA5D6-62C6-4D7E-8023-967CF134E26C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperSocket.Server.Abstractions", "src\SuperSocket.Server.Abstractions\SuperSocket.Server.Abstractions.csproj", "{8454E8D5-777D-46CB-B050-76C5119B624B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperSocket.Connection", "src\SuperSocket.Connection\SuperSocket.Connection.csproj", "{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SuperSocket.Kestrel", "src\SuperSocket.Kestrel\SuperSocket.Kestrel.csproj", "{8C8507D6-903F-4786-8F18-ACA54257454B}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameFrameX.SuperSocket.Server", "src\GameFrameX.SuperSocket.Server\GameFrameX.SuperSocket.Server.csproj", "{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -73,30 +67,6 @@ Global
{7EE705BE-5645-451B-B5A2-50408F63A222}.Release|x64.Build.0 = Release|Any CPU
{7EE705BE-5645-451B-B5A2-50408F63A222}.Release|x86.ActiveCfg = Release|Any CPU
{7EE705BE-5645-451B-B5A2-50408F63A222}.Release|x86.Build.0 = Release|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Debug|x64.ActiveCfg = Debug|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Debug|x64.Build.0 = Debug|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Debug|x86.ActiveCfg = Debug|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Debug|x86.Build.0 = Debug|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Release|Any CPU.Build.0 = Release|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Release|x64.ActiveCfg = Release|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Release|x64.Build.0 = Release|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Release|x86.ActiveCfg = Release|Any CPU
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3}.Release|x86.Build.0 = Release|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Debug|x64.ActiveCfg = Debug|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Debug|x64.Build.0 = Debug|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Debug|x86.ActiveCfg = Debug|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Debug|x86.Build.0 = Debug|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Release|Any CPU.Build.0 = Release|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Release|x64.ActiveCfg = Release|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Release|x64.Build.0 = Release|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Release|x86.ActiveCfg = Release|Any CPU
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56}.Release|x86.Build.0 = Release|Any CPU
{E9B31C8C-EC67-486B-9972-F6B4452BF050}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9B31C8C-EC67-486B-9972-F6B4452BF050}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9B31C8C-EC67-486B-9972-F6B4452BF050}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -157,18 +127,6 @@ Global
{62BC2056-F454-4E7A-86E5-1C2E866145AB}.Release|x64.Build.0 = Release|Any CPU
{62BC2056-F454-4E7A-86E5-1C2E866145AB}.Release|x86.ActiveCfg = Release|Any CPU
{62BC2056-F454-4E7A-86E5-1C2E866145AB}.Release|x86.Build.0 = Release|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Debug|x64.ActiveCfg = Debug|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Debug|x64.Build.0 = Debug|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Debug|x86.ActiveCfg = Debug|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Debug|x86.Build.0 = Debug|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Release|Any CPU.Build.0 = Release|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Release|x64.ActiveCfg = Release|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Release|x64.Build.0 = Release|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Release|x86.ActiveCfg = Release|Any CPU
{A68F2204-5021-4657-AACC-971FEBA385EB}.Release|x86.Build.0 = Release|Any CPU
{1C563726-BBB3-4D2D-B426-6C1A72A5B959}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C563726-BBB3-4D2D-B426-6C1A72A5B959}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C563726-BBB3-4D2D-B426-6C1A72A5B959}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -181,18 +139,6 @@ Global
{1C563726-BBB3-4D2D-B426-6C1A72A5B959}.Release|x64.Build.0 = Release|Any CPU
{1C563726-BBB3-4D2D-B426-6C1A72A5B959}.Release|x86.ActiveCfg = Release|Any CPU
{1C563726-BBB3-4D2D-B426-6C1A72A5B959}.Release|x86.Build.0 = Release|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Debug|x64.ActiveCfg = Debug|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Debug|x64.Build.0 = Debug|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Debug|x86.ActiveCfg = Debug|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Debug|x86.Build.0 = Debug|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Release|Any CPU.Build.0 = Release|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Release|x64.ActiveCfg = Release|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Release|x64.Build.0 = Release|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Release|x86.ActiveCfg = Release|Any CPU
{4DFB226C-2D1A-4346-B984-468A523209AF}.Release|x86.Build.0 = Release|Any CPU
{695AA5D6-62C6-4D7E-8023-967CF134E26C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{695AA5D6-62C6-4D7E-8023-967CF134E26C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{695AA5D6-62C6-4D7E-8023-967CF134E26C}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -241,6 +187,30 @@ Global
{8C8507D6-903F-4786-8F18-ACA54257454B}.Release|x64.Build.0 = Release|Any CPU
{8C8507D6-903F-4786-8F18-ACA54257454B}.Release|x86.ActiveCfg = Release|Any CPU
{8C8507D6-903F-4786-8F18-ACA54257454B}.Release|x86.Build.0 = Release|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Debug|x64.ActiveCfg = Debug|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Debug|x64.Build.0 = Debug|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Debug|x86.ActiveCfg = Debug|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Debug|x86.Build.0 = Debug|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Release|Any CPU.Build.0 = Release|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Release|x64.ActiveCfg = Release|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Release|x64.Build.0 = Release|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Release|x86.ActiveCfg = Release|Any CPU
{1E6262B5-2120-415E-889C-F3477D7800B0}.Release|x86.Build.0 = Release|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Debug|x64.ActiveCfg = Debug|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Debug|x64.Build.0 = Debug|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Debug|x86.ActiveCfg = Debug|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Debug|x86.Build.0 = Debug|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Release|Any CPU.Build.0 = Release|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Release|x64.ActiveCfg = Release|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Release|x64.Build.0 = Release|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Release|x86.ActiveCfg = Release|Any CPU
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -248,20 +218,18 @@ Global
GlobalSection(NestedProjects) = preSolution
{A1317CCC-70F4-4F32-84DE-2AAF68E346D2} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{7EE705BE-5645-451B-B5A2-50408F63A222} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{0A6AD2CC-E14C-43FF-BDA8-0F6DD0290CA3} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{FF75EEF9-2CB9-4E6F-A5A8-38F2199B4B56} = {4040EEC4-6FB7-47B1-B487-23E043A0F52F}
{E9B31C8C-EC67-486B-9972-F6B4452BF050} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{E1C29FC7-8A20-4811-94A5-0B80F1632E9D} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{D648690B-1D08-4B8D-A299-681938B128F2} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{4E9A4A13-0F74-4325-803A-351447336859} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{62BC2056-F454-4E7A-86E5-1C2E866145AB} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{A68F2204-5021-4657-AACC-971FEBA385EB} = {4040EEC4-6FB7-47B1-B487-23E043A0F52F}
{1C563726-BBB3-4D2D-B426-6C1A72A5B959} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{4DFB226C-2D1A-4346-B984-468A523209AF} = {4040EEC4-6FB7-47B1-B487-23E043A0F52F}
{695AA5D6-62C6-4D7E-8023-967CF134E26C} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{8454E8D5-777D-46CB-B050-76C5119B624B} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{FC2B529F-4AF4-4C39-BC4F-A3836CC7B37C} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{8C8507D6-903F-4786-8F18-ACA54257454B} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{1E6262B5-2120-415E-889C-F3477D7800B0} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
{80CC9ED4-0ABA-4DB6-A2EC-DFABE93A23BF} = {DDA4741E-097F-40C3-A252-2E1E3476C1A7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {ADB30AA2-A848-4CB3-8A20-488C80F1BA9E}

View File

@ -1,4 +0,0 @@
using System.Runtime.CompilerServices;
[assembly:InternalsVisibleTo("SuperSocket.Tests")]
[assembly:InternalsVisibleTo("SuperSocket.Benchmarks")]

View File

@ -6,39 +6,35 @@
[![NuGet](https://img.shields.io/nuget/dt/SuperSocket.svg)](https://www.nuget.org/packages/SuperSocket)
[![Badge](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu/#/en_US)
**SuperSocket** is a light weight extensible socket application framework. You can use it to build an always connected socket application easily without thinking about how to use socket, how to maintain the socket connections and how socket works. It is a pure C# project which is designed to be
extended, so it is easy to be integrated to your existing systems as long as they are developed in .NET language.
**SuperSocket** is a light weight extensible socket application framework. You can use it to build an always connected socket application easily without thinking about how to use socket, how to maintain the socket connections and how socket works. It is a pure C# project which is designed to be extended, so it is easy to be integrated to your existing systems as long as they are developed in .NET language.
- **Project homepage**: [https://www.supersocket.net/](https://www.supersocket.net/)
- **Documentation**: [https://docs.supersocket.net/](https://docs.supersocket.net/)
- **License**: [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)
- **Project homepage**: [https://www.supersocket.net/](https://www.supersocket.net/)
- **Documentation**: [https://docs.supersocket.net/](https://docs.supersocket.net/)
- **License**: [https://www.apache.org/licenses/LICENSE-2.0](https://www.apache.org/licenses/LICENSE-2.0)
---
##### Nuget Packages
| Package | MyGet Version | NuGet Version | Download |
| :------|:------------:|:------------:|:--------:|
| **SuperSocket** <br /> (all in one) | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.svg?style=flat)](https://www.nuget.org/packages/SuperSocket/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.svg?style=flat)](https://www.nuget.org/packages/SuperSocket/) |
| ~~**SuperSocket.WebSocketServer**~~ <br /> (Use SuperSocket.WebSocket.Server instead) | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.WebSocketServer)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.WebSocketServer) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.WebSocketServer.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocketServer/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.WebSocketServer.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocketServer/) |
| **SuperSocket.ProtoBase** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.ProtoBase)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.ProtoBase) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.ProtoBase.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.ProtoBase/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.ProtoBase.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.ProtoBase/) |
| **SuperSocket.Primitives** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Primitives)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Primitives) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Primitives.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Primitives/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Primitives.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Primitives/) |
| ~~**SuperSocket.Channel**~~ | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Channel)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Channel) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Channel.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Channel/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Channel.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Channel/) |
| **SuperSocket.Connection** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Connection)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Connection) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Connection.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Connection/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Connection.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Connection/) |
| **SuperSocket.Kestrel** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Kestrel)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Kestrel) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Kestrel.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Kestrel/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Kestrel.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Kestrel/) |
| **SuperSocket.Server** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Server)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Server) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Server.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Server/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Server.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Server/) |
| **SuperSocket.Server.Abstractions** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Server.Abstractions)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Server.Abstractions) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Server.Abstractions.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Server.Abstractions/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Server.Abstractions.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Server.Abstractions/) |
| **SuperSocket.Command** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Command)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Command) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Command.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Command/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Command.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Command/) |
| ~~**SuperSocket.SessionContainer**~~ | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.SessionContainer)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.SessionContainer) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.SessionContainer.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.SessionContainer/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.SessionContainer.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.SessionContainer/) |
| **SuperSocket.Client** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Client)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Client) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Client.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Client/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Client.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Client/) |
| **SuperSocket.Client.Proxy** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Client.Proxy)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Client.Proxy) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Client.Proxy.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Client.Proxy/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Client.Proxy.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Client.Proxy/) |
| **SuperSocket.WebSocket** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.WebSocket)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.WebSocket) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.WebSocket.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocket/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.WebSocket.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocket/) |
| **SuperSocket.WebSocket.Server** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.WebSocket.Server)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.WebSocket.Server) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.WebSocket.Server.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocket.Server/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.WebSocket.Server.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocket.Server/) |
| **SuperSocket.Udp** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Udp)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Udp) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Udp.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Udp/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Udp.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Udp/) |
| ~~**SuperSocket.GZip**~~ | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.GZip)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.GZip) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.GZip.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.GZip/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.GZip.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.GZip/) |
| **SuperSocket.SerialIO** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.SerialIO)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.SerialIO) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.SerialIO.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.SerialIO/)| [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.SerialIO.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.SerialIO/) |
| Package | MyGet Version | NuGet Version | Download |
|:--------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| **SuperSocket** <br /> (all in one) | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.svg?style=flat)](https://www.nuget.org/packages/SuperSocket/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.svg?style=flat)](https://www.nuget.org/packages/SuperSocket/) |
| ~~**SuperSocket.WebSocketServer**~~ <br /> (Use SuperSocket.WebSocket.Server instead) | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.WebSocketServer)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.WebSocketServer) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.WebSocketServer.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocketServer/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.WebSocketServer.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocketServer/) |
| **SuperSocket.ProtoBase** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.ProtoBase)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.ProtoBase) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.ProtoBase.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.ProtoBase/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.ProtoBase.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.ProtoBase/) |
| **SuperSocket.Primitives** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Primitives)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Primitives) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Primitives.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Primitives/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Primitives.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Primitives/) |
| ~~**SuperSocket.Channel**~~ | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Channel)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Channel) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Channel.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Channel/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Channel.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Channel/) |
| **SuperSocket.Connection** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Connection)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Connection) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Connection.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Connection/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Connection.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Connection/) |
| **SuperSocket.Server** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Server)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Server) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Server.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Server/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Server.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Server/) |
| **SuperSocket.Command** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Command)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Command) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Command.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Command/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Command.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Command/) |
| ~~**SuperSocket.SessionContainer**~~ | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.SessionContainer)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.SessionContainer) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.SessionContainer.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.SessionContainer/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.SessionContainer.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.SessionContainer/) |
| **SuperSocket.Client** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Client)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Client) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Client.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Client/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Client.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Client/) |
| **SuperSocket.Client.Proxy** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Client.Proxy)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Client.Proxy) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Client.Proxy.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Client.Proxy/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Client.Proxy.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Client.Proxy/) |
| **SuperSocket.WebSocket** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.WebSocket)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.WebSocket) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.WebSocket.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocket/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.WebSocket.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocket/) |
| **SuperSocket.WebSocket.Server** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.WebSocket.Server)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.WebSocket.Server) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.WebSocket.Server.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocket.Server/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.WebSocket.Server.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.WebSocket.Server/) |
| **SuperSocket.Udp** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.Udp)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.Udp) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.Udp.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Udp/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.Udp.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.Udp/) |
| ~~**SuperSocket.GZip**~~ | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.GZip)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.GZip) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.GZip.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.GZip/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.GZip.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.GZip/) |
| **SuperSocket.SerialIO** | [![MyGet Version](https://img.shields.io/myget/supersocket/vpre/SuperSocket.SerialIO)](https://www.myget.org/feed/supersocket/package/nuget/SuperSocket.SerialIO) | [![NuGet Version](https://img.shields.io/nuget/vpre/SuperSocket.SerialIO.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.SerialIO/) | [![NuGet Download](https://img.shields.io/nuget/dt/SuperSocket.SerialIO.svg?style=flat)](https://www.nuget.org/packages/SuperSocket.SerialIO/) |
Nightly build packages: https://www.myget.org/F/supersocket/api/v3/index.json
@ -46,7 +42,6 @@ Nightly build packages: https://www.myget.org/F/supersocket/api/v3/index.json
## SuperSocket 2.0 Roadmap:
- 2024:
- More documents
- Performance test/tuning

Binary file not shown.

View File

@ -1,6 +0,0 @@
{
"sdk": {
"version": "8.0.0",
"rollForward": "latestFeature"
}
}

View File

@ -1,42 +0,0 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>SuperSocket.Engine</id>
<title>SuperSocket.Engine</title>
<version>$version$</version>
<authors>Kerry Jiang</authors>
<owners>Kerry Jiang</owners>
<license type="expression">Apache-2.0</license>
<projectUrl>http://www.supersocket.net/</projectUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>SuperSocket is a light weight, cross platform and extensible socket server application framework. You can use it to build a server side socket application (like game server, GPS server, industrial control system, data acquisition server etc) easily without thinking about how to use socket, how to maintain the socket connections and how socket works.</description>
<tags>SuperSocket, Socket Server, .Net Socket Server Framework</tags>
<repository type="git" url="https://github.com/kerryjiang/SuperSocket.git" />
<dependencies>
<dependency id="log4net" version="2.0.3" />
<dependency id="SuperSocket" version="$version$" />
</dependencies>
<references>
<reference file="SuperSocket.SocketEngine.dll" />
<reference file="SuperSocket.SocketService.exe" />
</references>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Configuration" />
</frameworkAssemblies>
</metadata>
<files>
<file src="Solution Items\log4net.config" target="content\Config" />
<file src="Solution Items\log4net.unix.config" target="content\Config" />
<file src="SocketService\supersocket.cmd" target="content" />
<file src="SocketService\supersocket.sh" target="content" />
<file src="bin\net35\$configuration$\SuperSocket.SocketEngine.dll" target="lib/net35" />
<file src="bin\net35\$configuration$\SuperSocket.SocketEngine.XML" target="lib/net35" />
<file src="bin\net35\$configuration$\SuperSocket.SocketService.exe" target="lib/net35" />
<file src="bin\net40\$configuration$\SuperSocket.SocketEngine.dll" target="lib/net40" />
<file src="bin\net40\$configuration$\SuperSocket.SocketEngine.XML" target="lib/net40" />
<file src="bin\net40\$configuration$\SuperSocket.SocketService.exe" target="lib/net40" />
<file src="bin\net45\$configuration$\SuperSocket.SocketEngine.dll" target="lib/net45" />
<file src="bin\net45\$configuration$\SuperSocket.SocketEngine.XML" target="lib/net45" />
<file src="bin\net45\$configuration$\SuperSocket.SocketService.exe" target="lib/net45" />
</files>
</package>

View File

@ -1,31 +0,0 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>SuperSocket.WebSocket</id>
<title>SuperSocket.WebSocket</title>
<version>$version$</version>
<authors>Kerry Jiang</authors>
<owners>Kerry Jiang</owners>
<license type="expression">Apache-2.0</license>
<projectUrl>http://www.supersocket.net/</projectUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>WebSocket server implementation base on SuperSocket. It is just the same codebase with SuperWebSocket but has different assembly name and namespace.</description>
<tags>SuperSocket, WebSocket, SuperWebSocket</tags>
<repository type="git" url="https://github.com/kerryjiang/SuperSocket.git" />
<dependencies>
<dependency id="log4net" version="2.0.3" />
<dependency id="SuperSocket" version="$version$" />
</dependencies>
<references>
<reference file="SuperSocket.WebSocket.dll" />
</references>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Configuration" />
</frameworkAssemblies>
</metadata>
<files>
<file src="bin\net35\$configuration$\SuperSocket.WebSocket.dll" target="lib/net35" />
<file src="bin\net40\$configuration$\SuperSocket.WebSocket.dll" target="lib/net40" />
<file src="bin\net45\$configuration$\SuperSocket.WebSocket.dll" target="lib/net45" />
</files>
</package>

View File

@ -1,47 +0,0 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>SuperSocket</id>
<title>SuperSocket</title>
<version>$version$</version>
<authors>Kerry Jiang</authors>
<owners>Kerry Jiang</owners>
<license type="expression">Apache-2.0</license>
<projectUrl>http://www.supersocket.net/</projectUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>SuperSocket is a light weight, cross platform and extensible socket server application framework. You can use it to build a server side socket application (like game server, GPS server, industrial control system, data acquisition server etc) easily without thinking about how to use socket, how to maintain the socket connections and how socket works.</description>
<tags>SuperSocket, Socket Server, .Net Socket Server Framework</tags>
<repository type="git" url="https://github.com/kerryjiang/SuperSocket.git" />
<dependencies>
<dependency id="log4net" version="2.0.3" />
</dependencies>
<references>
<reference file="SuperSocket.Common.dll" />
<reference file="SuperSocket.SocketBase.dll" />
<reference file="SuperSocket.Facility.dll" />
</references>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Configuration" />
</frameworkAssemblies>
</metadata>
<files>
<file src="bin\net35\$configuration$\SuperSocket.Common.dll" target="lib/net35" />
<file src="bin\net35\$configuration$\SuperSocket.Common.XML" target="lib/net35" />
<file src="bin\net35\$configuration$\SuperSocket.SocketBase.dll" target="lib/net35" />
<file src="bin\net35\$configuration$\SuperSocket.SocketBase.XML" target="lib/net35" />
<file src="bin\net35\$configuration$\SuperSocket.Facility.dll" target="lib/net35" />
<file src="bin\net35\$configuration$\SuperSocket.Facility.XML" target="lib/net35" />
<file src="bin\net40\$configuration$\SuperSocket.Common.dll" target="lib/net40" />
<file src="bin\net40\$configuration$\SuperSocket.Common.XML" target="lib/net40" />
<file src="bin\net40\$configuration$\SuperSocket.SocketBase.dll" target="lib/net40" />
<file src="bin\net40\$configuration$\SuperSocket.SocketBase.XML" target="lib/net40" />
<file src="bin\net40\$configuration$\SuperSocket.Facility.dll" target="lib/net40" />
<file src="bin\net40\$configuration$\SuperSocket.Facility.XML" target="lib/net40" />
<file src="bin\net45\$configuration$\SuperSocket.Common.dll" target="lib/net45" />
<file src="bin\net45\$configuration$\SuperSocket.Common.XML" target="lib/net45" />
<file src="bin\net45\$configuration$\SuperSocket.SocketBase.dll" target="lib/net45" />
<file src="bin\net45\$configuration$\SuperSocket.SocketBase.XML" target="lib/net45" />
<file src="bin\net45\$configuration$\SuperSocket.Facility.dll" target="lib/net45" />
<file src="bin\net45\$configuration$\SuperSocket.Facility.XML" target="lib/net45" />
</files>
</package>

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 KiB

View File

@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>
<NuspecFile>SuperSocket.nuspec</NuspecFile>
<IncludeSymbols>false</IncludeSymbols>
<IncludeSource>false</IncludeSource>
</PropertyGroup>
</Project>

View File

@ -1,38 +0,0 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>SuperSocket</id>
<title>SuperSocket</title>
<version>$version$</version>
<authors>Kerry Jiang</authors>
<owners>Kerry Jiang and other contributors</owners>
<license type="expression">Apache-2.0</license>
<projectUrl>http://www.supersocket.net/</projectUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>SuperSocket is a light weight, cross platform and extensible socket server application framework. You can use it to build a server side socket application (like game server, GPS server, industrial control system, data acquisition server etc) easily without thinking about how to use socket, how to maintain the socket connections and how socket works.</description>
<tags>SuperSocket, Socket Server, .Net Socket Server Framework</tags>
<repository type="git" url="https://github.com/kerryjiang/SuperSocket.git" />
<dependencies>
<group targetFramework=".NETStandard2.1">
<dependency id="SuperSocket.Server" version="$version$" exclude="Build,Analyzers" />
<dependency id="SuperSocket.Command" version="$version$" exclude="Build,Analyzers" />
</group>
<group targetFramework="net5.0">
<dependency id="SuperSocket.Server" version="$version$" exclude="Build,Analyzers" />
<dependency id="SuperSocket.Command" version="$version$" exclude="Build,Analyzers" />
</group>
<group targetFramework="net6.0">
<dependency id="SuperSocket.Server" version="$version$" exclude="Build,Analyzers" />
<dependency id="SuperSocket.Command" version="$version$" exclude="Build,Analyzers" />
</group>
<group targetFramework="net7.0">
<dependency id="SuperSocket.Server" version="$version$" exclude="Build,Analyzers" />
<dependency id="SuperSocket.Command" version="$version$" exclude="Build,Analyzers" />
</group>
<group targetFramework="net8.0">
<dependency id="SuperSocket.Server" version="$version$" exclude="Build,Analyzers" />
<dependency id="SuperSocket.Command" version="$version$" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
</package>

View File

@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>$(SamplesTargetFrameworks)</TargetFrameworks>
<LangVersion>10</LangVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\SuperSocket.Server\SuperSocket.Server.csproj" />
</ItemGroup>
</Project>

View File

@ -1,27 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using SuperSocket.Server;
using SuperSocket.Server.Host;
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.ProtoBase;
using System.Text;
var builder = WebApplication.CreateBuilder(args);
builder.Host.AsSuperSocketHostBuilder<TextPackageInfo>()
.UsePipelineFilter<LinePipelineFilter>()
.UsePackageHandler(async (s, p) =>
{
// echo message back to client
await s.SendAsync(Encoding.UTF8.GetBytes(p.Text + "\r\n"));
})
.UseInProcSessionContainer()
.AsMinimalApiHostBuilder()
.ConfigureHostBuilder();
var app = builder.Build();
app.MapGet("api/session", ([FromServices]ISessionContainer sessions) =>Microsoft.AspNetCore.Http.Results.Json(sessions.GetSessions()));
await app.RunAsync();

View File

@ -1,28 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:56335",
"sslPort": 44385
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/session",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"AspNetSample": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

View File

@ -1,19 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"serverOptions": {
"name": "TestServer",
"listeners": [
{
"ip": "Any",
"port": 4040
}
]
},
"AllowedHosts": "*"
}

View File

@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>$(SamplesTargetFrameworks)</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/SuperSocket.Client/SuperSocket.Client.csproj" />
</ItemGroup>
</Project>

View File

@ -1,20 +0,0 @@
using System;
namespace BasicClient
{
public enum OpCode : byte
{
Connect = 1,
Subscribe = 2,
Publish = 3
}
public class MyPackage
{
public OpCode Code { get; set; }
public short Sequence { get; set; }
public string Body { get; set; }
}
}

View File

@ -1,55 +0,0 @@
using System;
using System.Buffers;
using System.Text;
using SuperSocket;
using SuperSocket.ProtoBase;
namespace BasicClient
{
public class MyPackageFilter : FixedHeaderPipelineFilter<MyPackage>
{
/// <summary>
/// Header size is 5
/// 1: OpCode
/// 2-3: body length
/// 4-5: sequence
/// </summary>
public MyPackageFilter()
: base(5)
{
}
protected override int GetBodyLengthFromHeader(ref ReadOnlySequence<byte> buffer)
{
var reader = new SequenceReader<byte>(buffer);
reader.Advance(1); // skip the first byte for OpCode
reader.TryReadBigEndian(out short len);
reader.Advance(2); // skip the two bytes for Sequence
return len;
}
protected override MyPackage DecodePackage(ref ReadOnlySequence<byte> buffer)
{
var package = new MyPackage();
var reader = new SequenceReader<byte>(buffer);
reader.TryRead(out byte opCodeByte);
package.Code = (OpCode)opCodeByte;
// skip the two bytes for length, we don't need length any more
// because we already get the full data of the package in the buffer
reader.Advance(2);
reader.TryReadBigEndian(out short sequence);
package.Sequence = sequence;
// get the rest of the data in the reader and then read it as utf8 string
package.Body = reader.ReadString(Encoding.UTF8);
return package;
}
}
}

View File

@ -1,35 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using SuperSocket.Client;
using SuperSocket.ProtoBase;
namespace BasicClient
{
class Program
{
static async Task Main(string[] args)
{
var client = new EasyClient<MyPackage>(new MyPackageFilter()).AsClient();
if (!await client.ConnectAsync(new IPEndPoint(IPAddress.Loopback, 4040)))
{
Console.WriteLine("Failed to connect the target server.");
return;
}
while (true)
{
var p = await client.ReceiveAsync();
if (p == null) // connection dropped
break;
Console.WriteLine(p.Body);
}
}
}
}

View File

@ -1,24 +0,0 @@
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using SuperSocket;
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.Command;
using SuperSocket.ProtoBase;
namespace CommandServer
{
[Command("add")]
public class ADD : IAsyncCommand<StringPackageInfo>
{
public async ValueTask ExecuteAsync(IAppSession session, StringPackageInfo package, CancellationToken cancellationToken)
{
var result = package.Parameters
.Select(p => int.Parse(p))
.Sum();
await session.SendAsync(Encoding.UTF8.GetBytes(result.ToString() + "\r\n"), cancellationToken);
}
}
}

View File

@ -1,12 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>$(SamplesTargetFrameworks)</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/SuperSocket.Server/SuperSocket.Server.csproj" />
<ProjectReference Include="../../src/SuperSocket.Command/SuperSocket.Command.csproj" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="$(MSExtensionsVersion)" />
</ItemGroup>
</Project>

View File

@ -1,25 +0,0 @@
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using SuperSocket;
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.Command;
using SuperSocket.ProtoBase;
namespace CommandServer
{
[Command]
public class MULT : IAsyncCommand<StringPackageInfo>
{
public async ValueTask ExecuteAsync(IAppSession session, StringPackageInfo package, CancellationToken cancellationToken)
{
var result = package.Parameters
.Select(p => int.Parse(p))
.Aggregate((x, y) => x * y);
await session.SendAsync(Encoding.UTF8.GetBytes(result.ToString() + "\r\n"), cancellationToken);
}
}
}

View File

@ -1,50 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SuperSocket.Server;
using SuperSocket.Server.Host;
using SuperSocket.Command;
using SuperSocket.ProtoBase;
namespace CommandServer
{
class Program
{
static IHostBuilder CreateSocketServerBuilder(string[] args)
{
return SuperSocketHostBuilder.Create<StringPackageInfo, CommandLinePipelineFilter>(args)
.UseCommand((commandOptions) =>
{
// register commands one by one
commandOptions.AddCommand<ADD>();
commandOptions.AddCommand<MULT>();
commandOptions.AddCommand<SUB>();
// register all commands in one aassembly
//commandOptions.AddCommandAssembly(typeof(SUB).GetTypeInfo().Assembly);
})
.ConfigureAppConfiguration((hostCtx, configApp) =>
{
configApp.AddInMemoryCollection(new Dictionary<string, string>
{
{ "serverOptions:name", "TestServer" },
{ "serverOptions:listeners:0:ip", "Any" },
{ "serverOptions:listeners:0:port", "4040" }
});
})
.ConfigureLogging((hostCtx, loggingBuilder) =>
{
loggingBuilder.AddConsole();
});
}
static async Task Main(string[] args)
{
var host = CreateSocketServerBuilder(args).Build();
await host.RunAsync();
}
}
}

View File

@ -1,27 +0,0 @@
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using SuperSocket;
using SuperSocket.Server.Abstractions.Session;
using SuperSocket.Command;
using SuperSocket.ProtoBase;
namespace CommandServer
{
public class SUB : IAsyncCommand<StringPackageInfo>
{
public string Key => "SUB";
public string Name => Key;
public async ValueTask ExecuteAsync(IAppSession session, StringPackageInfo package, CancellationToken cancellationToken)
{
var result = package.Parameters
.Select(p => int.Parse(p))
.Aggregate((x, y) => x - y);
await session.SendAsync(Encoding.UTF8.GetBytes(result.ToString() + "\r\n"), cancellationToken);
}
}
}

View File

@ -1,19 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>$(SamplesTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/SuperSocket.Server/SuperSocket.Server.csproj" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="$(MSExtensionsVersion)" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\assets\supersocket.pfx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SuperSocket.Server;
using SuperSocket.Server.Host;
using SuperSocket.ProtoBase;
namespace ConfigSample
{
class Program
{
static async Task Main(string[] args)
{
var host = SuperSocketHostBuilder.Create<TextPackageInfo, LinePipelineFilter>(args)
.UsePackageHandler(async (s, p) =>
{
await s.SendAsync(Encoding.UTF8.GetBytes(p.Text + "\r\n"));
})
.ConfigureLogging((hostCtx, loggingBuilder) =>
{
// register your logging library here
loggingBuilder.AddConsole();
}).Build();
await host.RunAsync();
}
}
}

View File

@ -1,15 +0,0 @@
{
"serverOptions": {
"name": "TestServer",
"listeners": [
{
"ip": "Any",
"port": 4040
},
{
"ip": "Any",
"port": 4041
}
]
}
}

View File

@ -1,16 +0,0 @@
{
"serverOptions": {
"name": "TestServer",
"maxPackageLength": 10240,
"receiveBufferSize": 12240,
"sendBufferSize": 12240,
"receiveTimeout": 60000,
"sendTimeout": 60000,
"listeners": [
{
"ip": "Any",
"port": 4040
}
]
}
}

View File

@ -1,16 +0,0 @@
{
"serverOptions": {
"name": "TestServer",
"listeners": [
{
"ip": "Any",
"port": 4040,
"security": "Tls12",
"certificateOptions" : {
"filePath": "supersocket.pfx",
"password": "supersocket"
}
}
]
}
}

View File

@ -1,10 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>$(SamplesTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\SuperSocket.Server\SuperSocket.Server.csproj" />
</ItemGroup>
</Project>

View File

@ -1,20 +0,0 @@
using System;
namespace CustomProtocol
{
public enum OpCode : byte
{
Connect = 1,
Subscribe = 2,
Publish = 3
}
public class MyPackage
{
public OpCode Code { get; set; }
public short Sequence { get; set; }
public string Body { get; set; }
}
}

View File

@ -1,55 +0,0 @@
using System;
using System.Buffers;
using System.Text;
using SuperSocket;
using SuperSocket.ProtoBase;
namespace CustomProtocol
{
public class MyPackageFilter : FixedHeaderPipelineFilter<MyPackage>
{
/// <summary>
/// Header size is 5
/// 1: OpCode
/// 2-3: body length
/// 4-5: sequence
/// </summary>
public MyPackageFilter()
: base(5)
{
}
protected override int GetBodyLengthFromHeader(ref ReadOnlySequence<byte> buffer)
{
var reader = new SequenceReader<byte>(buffer);
reader.Advance(1); // skip the first byte for OpCode
reader.TryReadBigEndian(out short len);
reader.Advance(2); // skip the two bytes for Sequence
return len;
}
protected override MyPackage DecodePackage(ref ReadOnlySequence<byte> buffer)
{
var package = new MyPackage();
var reader = new SequenceReader<byte>(buffer);
reader.TryRead(out byte opCodeByte);
package.Code = (OpCode)opCodeByte;
// skip the two bytes for length, we don't need length any more
// because we already get the full data of the package in the buffer
reader.Advance(2);
reader.TryReadBigEndian(out short sequence);
package.Sequence = sequence;
// get the rest of the data in the reader and then read it as utf8 string
package.Body = reader.Sequence.Slice(reader.Consumed).GetString(Encoding.UTF8);
return package;
}
}
}

View File

@ -1,42 +0,0 @@
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SuperSocket.Server;
using SuperSocket.Server.Abstractions;
using SuperSocket.Server.Host;
namespace CustomProtocol
{
class Program
{
static async Task Main(string[] args)
{
var host = SuperSocketHostBuilder.Create<MyPackage, MyPackageFilter>(args)
.UsePackageHandler(async (s, p) =>
{
// handle package
await Task.Delay(0);
})
.ConfigureSuperSocket(options =>
{
options.Name = "CustomProtocol Server";
options.Listeners = new List<ListenOptions>
{
new ListenOptions
{
Ip = "Any",
Port = 4040
}
};
})
.ConfigureLogging((hostCtx, loggingBuilder) =>
{
loggingBuilder.AddConsole();
}).Build();
await host.RunAsync();
}
}
}

View File

@ -1,11 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>$(SamplesTargetFrameworks)</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../../src/SuperSocket.Server/SuperSocket.Server.csproj" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="$(MSExtensionsVersion)" />
</ItemGroup>
</Project>

View File

@ -1,42 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SuperSocket.Server;
using SuperSocket.Server.Abstractions;
using SuperSocket.Server.Host;
using SuperSocket.ProtoBase;
namespace EchoServer
{
class Program
{
static async Task Main(string[] args)
{
var host = SuperSocketHostBuilder.Create<TextPackageInfo, LinePipelineFilter>(args)
.UsePackageHandler(async (s, p) =>
{
await s.SendAsync(Encoding.UTF8.GetBytes(p.Text + "\r\n"));
})
.ConfigureSuperSocket(options =>
{
options.Name = "Echo Server";
options.AddListener(new ListenOptions
{
Ip = "Any",
Port = 4040
}
);
})
.ConfigureLogging((hostCtx, loggingBuilder) =>
{
loggingBuilder.AddConsole();
})
.Build();
await host.RunAsync();
}
}
}

View File

@ -1,231 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# 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/
build/
bld/
bin/
Bin/
obj/
Obj/
# Visual Studio 2015 cache/options directory
.vs/
# 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
*_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
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# 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
# 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
# TODO: 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
# 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
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# 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
*.pfx
*.publishsettings
orleans.codegen.cs
/node_modules
# 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
# 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
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# 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
# FAKE - F# Make
.fake/

View File

@ -1,12 +0,0 @@
using Microsoft.Extensions.Logging;
using SuperSocket;
using SuperSocket.WebSocket.Server;
namespace LiveChat
{
public class ChatSession : WebSocketSession
{
public string Name { get; set; }
}
}

View File

@ -1,9 +0,0 @@
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For IE 9-11 support, please uncomment the last line of the file and adjust as needed
> 0.5%
last 2 versions
Firefox ESR
not dead
# IE 9-11

View File

@ -1,13 +0,0 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false

View File

@ -1,40 +0,0 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/dist-server
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db

View File

@ -1,27 +0,0 @@
# LiveChat
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.0.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

View File

@ -1,156 +0,0 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": {
"analytics": "12098f43-6df1-4ace-a4c6-1938c8d0bde7"
},
"version": 1,
"newProjectRoot": "projects",
"projects": {
"LiveChat": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"progress": false,
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/assets"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"src/styles.css"
],
"scripts": [],
"aot": true
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "LiveChat:build"
},
"configurations": {
"production": {
"browserTarget": "LiveChat:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "LiveChat:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.css"
],
"scripts": [],
"assets": [
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist-server",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.server.json"
},
"configurations": {
"dev": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true
},
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true
}
}
}
}
},
"LiveChat-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "LiveChat:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "LiveChat"
}

File diff suppressed because it is too large Load Diff

View File

@ -1,61 +0,0 @@
{
"name": "livechat",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build:ssr": "ng run LiveChat:server:dev",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "11.0.2",
"@angular/cdk": "~11.0.0",
"@angular/common": "11.0.2",
"@angular/compiler": "11.0.2",
"@angular/core": "11.0.2",
"@angular/flex-layout": "^11.0.0-beta.33",
"@angular/forms": "11.0.2",
"@angular/material": "^11.0.0",
"@angular/platform-browser": "11.0.2",
"@angular/platform-browser-dynamic": "11.0.2",
"@angular/platform-server": "11.0.2",
"@angular/router": "11.0.2",
"@nguniversal/module-map-ngfactory-loader": "8.1.1",
"aspnet-prerendering": "^3.0.1",
"bootstrap": "^4.3.1",
"core-js": "^3.3.3",
"jquery": "^3.5.1",
"oidc-client": "^1.9.1",
"popper.js": "^1.16.0",
"rxjs": "^6.5.3",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1100.2",
"@angular/cli": "^11.2.5",
"@angular/compiler-cli": "^11.0.2",
"@angular/language-service": "^11.0.2",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.8",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.16",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"typescript": "4.0.5"
},
"optionalDependencies": {
"protractor": "~7.0.0",
"ts-node": "~8.4.1",
"tslint": "~6.1.0"
}
}

View File

@ -1,6 +0,0 @@
<body>
<app-nav-menu></app-nav-menu>
<div class="container">
<router-outlet></router-outlet>
</div>
</body>

View File

@ -1,10 +0,0 @@
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
title = 'app';
isConnected: boolean = false;
}

View File

@ -1,44 +0,0 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { NavMenuComponent } from './nav-menu/nav-menu.component';
import { LoginComponent } from './login/login.component';
import { RoomComponent } from './room/room.component';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { FlexLayoutModule } from '@angular/flex-layout';
@NgModule({
declarations: [
AppComponent,
NavMenuComponent,
LoginComponent,
RoomComponent
],
imports: [
BrowserModule,
HttpClientModule,
FormsModule,
ReactiveFormsModule,
RouterModule.forRoot([
{ path: '', component: LoginComponent, pathMatch: 'full' },
{ path: 'room', component: RoomComponent }
], { relativeLinkResolution: 'legacy' }),
NoopAnimationsModule,
MatFormFieldModule,
MatButtonModule,
MatInputModule,
MatCardModule,
FlexLayoutModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

View File

@ -1,11 +0,0 @@
import { NgModule } from '@angular/core';
import { ServerModule } from '@angular/platform-server';
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';
import { AppComponent } from './app.component';
import { AppModule } from './app.module';
@NgModule({
imports: [AppModule, ServerModule, ModuleMapLoaderModule],
bootstrap: [AppComponent]
})
export class AppServerModule { }

View File

@ -1,22 +0,0 @@
:host {
display: flex;
justify-content: center;
margin: 100px 0px;
}
mat-card {
max-width: 400px;
margin: 0px auto;
text-align: center;
}
mat-form-field {
width: 100%;
min-width: 300px;
}
mat-card-title,
mat-card-content {
display: flex;
justify-content: center;
}

View File

@ -1,12 +0,0 @@
<mat-card id="loginMatCard">
<mat-card-title>Log In</mat-card-title>
<mat-card-content>
<form [formGroup]="form" (ngSubmit)="connect()">
<mat-form-field>
<mat-label>Your Name</mat-label>
<input matInput placeholder="Ex: Kerry Jiang" formControlName="name" required>
</mat-form-field>
<button mat-raised-button type="submit" color="primary">Connect</button>
</form>
</mat-card-content>
</mat-card>

View File

@ -1,26 +0,0 @@
import { Component } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
import { ConnectionService } from '../services/connectionService';
import { Router } from '@angular/router';
@Component({
selector: 'app-home',
templateUrl: './login.component.html',
styleUrls: [ './login.component.css' ]
})
export class LoginComponent {
form: FormGroup = new FormGroup({
name: new FormControl('')
});
constructor(private connectionService: ConnectionService, private router: Router) {
}
async connect() {
if (this.form.valid) {
await this.connectionService.connect(this.form.get("name").value);
this.router.navigate([ "room" ]);
}
}
}

View File

@ -1,18 +0,0 @@
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}
html {
font-size: 14px;
}
@media (min-width: 768px) {
html {
font-size: 16px;
}
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}

View File

@ -1,20 +0,0 @@
<header>
<nav
class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3"
>
<div class="container">
<a class="navbar-brand" [routerLink]="['/']">LiveChat</a>
<div
class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse"
[ngClass]="{ show: isExpanded }">
<ul class="navbar-nav flex-grow">
<ng-template [ngIf]="isConnected">
<li class="nav-item" [routerLinkActive]="['link-active']">
<a class="nav-link text-dark" (click)="disconnect()"></a>
</li>
</ng-template>
</ul>
</div>
</div>
</nav>
</header>

View File

@ -1,33 +0,0 @@
import { Component } from '@angular/core';
import { ConnectionService } from '../services/connectionService';
@Component({
selector: 'app-nav-menu',
templateUrl: './nav-menu.component.html',
styleUrls: ['./nav-menu.component.css']
})
export class NavMenuComponent {
isExpanded = false;
isConnected = false;
constructor(private connectionService: ConnectionService)
{
}
showDisconnect() : boolean {
return this.connectionService.isConnected;
}
collapse() {
this.isExpanded = false;
}
toggle() {
this.isExpanded = !this.isExpanded;
}
async disconnect() {
this.connectionService.disconnect();
}
}

View File

@ -1,13 +0,0 @@
.layoutGrid {
height: calc(100% - 250px);
min-height: 600px;
}
.messageBoard {
padding: 2px;
background-color: silver;
}
textarea {
resize: none;
}

View File

@ -1,15 +0,0 @@
<div fxLayout="column" class="layoutGrid">
<div fxFlex="calc(100%-50px)" class="messageBoard">
<li class="message" *ngFor="let message of messages">
{{ message }}
</li>
</div>
<div fxFlex="50px">
<div fxFlex="calc(100%-100px)">
<textarea fxFlexFill noresize="noresize" [(ngModel)]="messageToSend"></textarea>
</div>
<div>
<button fxFlexFill type="button" (click)="onSubmit()">Enter</button>
</div>
</div>
</div>

View File

@ -1,34 +0,0 @@
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { ConnectionService } from '../services/connectionService';
@Component({
selector: 'app-home',
templateUrl: './room.component.html',
styleUrls: [ './room.component.css' ]
})
export class RoomComponent {
messageToSend: string = "";
messages: string[] = [];
constructor(private connectionService: ConnectionService, private router: Router) {
}
ngOnInit() {
if (!this.connectionService.isConnected) {
this.router.navigate([ "" ]);
return;
}
this.connectionService.msgSubject.subscribe(msg => {
this.messages = [...this.messages, msg];
});
}
onSubmit() {
if (this.messageToSend != null && this.messageToSend.length > 0) {
this.connectionService.send(this.messageToSend);
this.messageToSend = "";
}
}
}

View File

@ -1,48 +0,0 @@
import { webSocket, WebSocketSubject } from 'rxjs/webSocket';
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
@Injectable({
providedIn: 'root',
})
export class ConnectionService {
isConnected: boolean = false;
loginName: string;
chatWebsocket: WebSocketSubject<any>;
msgSubject = new Subject<string>();
async connect(name: string) {
this.chatWebsocket = webSocket({
//url: 'ws://localhost:4040',
url: 'wss://localhost:4041',
deserializer: msg => msg,
serializer: msg => msg
});
this.loginName = name;
this.isConnected = true;
this.chatWebsocket.asObservable().subscribe(
msg => {
this.msgSubject.next(msg.data);
},
err => console.log(err),
() => console.log('closed')
);
this.chatWebsocket.next('CON ' + name);
}
send(message: string) {
if (!this.isConnected)
return;
this.chatWebsocket.next("MSG " + message);
}
disconnect() {
this.chatWebsocket.complete();
}
}

View File

@ -1,3 +0,0 @@
export const environment = {
production: true
};

View File

@ -1,15 +0,0 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
};
/*
* In development mode, to ignore zone related error stack frames such as
* `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
* import the following file, but please comment it out in production mode
* because it will have performance impact when throw error
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.

View File

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>LiveChat</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<app-root>Loading...</app-root>
</body>
</html>

View File

@ -1,31 +0,0 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};

View File

@ -1,20 +0,0 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
export function getBaseUrl() {
return document.getElementsByTagName('base')[0].href;
}
const providers = [
{ provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] }
];
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic(providers).bootstrapModule(AppModule)
.catch(err => console.log(err));

View File

@ -1,63 +0,0 @@
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/**
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags.ts';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/

View File

@ -1,23 +0,0 @@
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
/* Provide sufficient contrast against white background */
a {
color: #0366d6;
}
code {
color: #e01a76;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
html, body { height: 100%; }
body {
font-family: Roboto, Arial, sans-serif;
margin: 0;
}

View File

@ -1,20 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

View File

@ -1,14 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": []
},
"files": [
"main.ts",
"polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}

View File

@ -1,15 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"target": "es2016"
},
"angularCompilerOptions": {
"entryModule": "app/app.server.module#AppServerModule"
},
"files": [
"main.ts"
],
"include": [
"src/**/*.d.ts"
]
}

View File

@ -1,18 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View File

@ -1,17 +0,0 @@
{
"extends": "../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
]
}
}

View File

@ -1,21 +0,0 @@
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"module": "es2020",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}

View File

@ -1,129 +0,0 @@
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"deprecation": {
"severity": "warn"
},
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs/Rx"
],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
{
"order": [
"static-field",
"instance-field",
"static-method",
"instance-method"
]
}
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-super": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-misused-new": true,
"no-non-null-assertion": true,
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unnecessary-initializer": true,
"no-unused-expression": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
true,
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"no-output-on-prefix": true,
"no-inputs-metadata-property": true,
"no-outputs-metadata-property": true,
"no-host-metadata-property": true,
"no-input-rename": true,
"no-output-rename": true,
"use-lifecycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true
}
}

View File

@ -1,26 +0,0 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using SuperSocket;
using SuperSocket.Command;
using SuperSocket.ProtoBase;
using SuperSocket.WebSocket.Server;
namespace LiveChat
{
public class CON : IAsyncCommand<ChatSession, StringPackageInfo>
{
private RoomService _roomService;
public CON(RoomService roomService)
{
_roomService = roomService;
}
public async ValueTask ExecuteAsync(ChatSession session, StringPackageInfo package)
{
session.Name = package.Body;
await _roomService.EnterRoom(session);
}
}
}

View File

@ -1,25 +0,0 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using SuperSocket;
using SuperSocket.Command;
using SuperSocket.ProtoBase;
using SuperSocket.WebSocket.Server;
namespace LiveChat
{
public class MSG : IAsyncCommand<ChatSession, StringPackageInfo>
{
private RoomService _roomService;
public MSG(RoomService roomService)
{
_roomService = roomService;
}
public async ValueTask ExecuteAsync(ChatSession session, StringPackageInfo package)
{
await _roomService.BroadcastMessage(session, package.Body);
}
}
}

View File

@ -1,63 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>$(SamplesTargetFrameworks)</TargetFrameworks>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<IsPackable>false</IsPackable>
<SpaRoot>ClientApp\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
<!-- Set this to true if you enable server-side prerendering -->
<BuildServerSideRenderer>false</BuildServerSideRenderer>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SuperSocket.WebSocketServer" Version="2.0.0-beta.8" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="3.1.5" />
</ItemGroup>
<ItemGroup>
<Content Include="..\..\assets\supersocket.pfx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<!-- Don't publish the SPA source files, but do show them in the project files list -->
<Content Remove="$(SpaRoot)**" />
<None Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
<!-- Ensure Node.js is installed -->
<Exec Command="node --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
</Target>
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build -- --prod" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build:ssr -- --prod" Condition=" '$(BuildServerSideRenderer)' == 'true' " />
<!-- Include the newly-built files in the publish output -->
<ItemGroup>
<DistFiles Include="$(SpaRoot)dist\**; $(SpaRoot)dist-server\**" />
<DistFiles Include="$(SpaRoot)node_modules\**" Condition="'$(BuildServerSideRenderer)' == 'true'" />
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
<RelativePath>%(DistFiles.Identity)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</ResolvedFileToPublish>
</ItemGroup>
</Target>
</Project>

View File

@ -1,26 +0,0 @@
@page
@model ErrorModel
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>

View File

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace LiveChat.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public class ErrorModel : PageModel
{
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}

View File

@ -1,3 +0,0 @@
@using LiveChat
@namespace LiveChat.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using SuperSocket.Command;
using SuperSocket.ProtoBase;
using SuperSocket.WebSocket.Server;
namespace LiveChat
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
}).AsWebSocketHostBuilder()
.UseSession<ChatSession>()
.ConfigureServices((context, services) =>
{
services.AddSingleton<RoomService>();
})
.UseCommand<StringPackageInfo, StringPackageConverter>(commandOptions =>
{
commandOptions.AddCommand<CON>();
commandOptions.AddCommand<MSG>();
});
}
}

View File

@ -1,27 +0,0 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5522",
"sslPort": 44324
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"LiveChat": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -1,64 +0,0 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using SuperSocket;
namespace LiveChat
{
public class RoomService
{
private ILogger _logger;
private HashSet<ChatSession> _users;
public RoomService(ILogger<RoomService> logger)
{
_logger = logger;
_users = new HashSet<ChatSession>();
}
public async ValueTask BroadcastMessage(ChatSession session, string message)
{
foreach (var u in _users)
{
await u.SendAsync($"{session.Name}: {message}");
}
}
public async ValueTask EnterRoom(ChatSession session)
{
lock (_users)
{
_users.Add(session);
}
foreach (var u in _users)
{
await u.SendAsync($"{session.Name} entered just now.");
}
_logger.LogInformation($"{session.Name} entered.");
session.Closed += async (s, e) =>
{
await LeaveRoom(s as ChatSession);
};
}
public async ValueTask LeaveRoom(ChatSession session)
{
lock (_users)
{
_users.Remove(session);
}
foreach (var u in _users)
{
await u.SendAsync($"{session.Name} left.");
}
_logger.LogInformation($"{session.Name} left.");
}
}
}

View File

@ -1,75 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.SpaServices.AngularCli;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace LiveChat
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
// In production, the Angular files will be served from this directory
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "ClientApp/dist";
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
//app.UseHttpsRedirection();
app.UseStaticFiles();
if (!env.IsDevelopment())
{
app.UseSpaStaticFiles();
}
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller}/{action=Index}/{id?}");
});
app.UseSpa(spa =>
{
// To learn more about options for serving an Angular SPA from ASP.NET Core,
// see https://go.microsoft.com/fwlink/?linkid=864501
spa.Options.SourcePath = "ClientApp";
if (env.IsDevelopment())
{
spa.UseProxyToSpaDevelopmentServer("http://localhost:4200");
}
});
}
}
}

View File

@ -1,20 +0,0 @@
using System;
using System.Linq;
using SuperSocket.Command;
using SuperSocket.ProtoBase;
using SuperSocket.WebSocket;
namespace LiveChat
{
class StringPackageConverter : IPackageMapper<WebSocketPackage, StringPackageInfo>
{
public StringPackageInfo Map(WebSocketPackage package)
{
var pack = new StringPackageInfo();
var arr = package.Message.Split(' ', 2, StringSplitOptions.RemoveEmptyEntries);
pack.Key = arr[0];
pack.Body = arr[1];
return pack;
}
}
}

View File

@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

View File

@ -1,29 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"serverOptions": {
"name": "ChatRoomServer",
"listeners": [
{
"ip": "Any",
"port": 4040,
"backLog": 100
},
{
"ip": "Any",
"port": 4041,
"security": "Tls12",
"certificateOptions" : {
"filePath": "supersocket.pfx",
"password": "supersocket"
}
}
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

View File

@ -1,26 +0,0 @@
using System;
using System.Buffers;
using SuperSocket.ProtoBase;
namespace SwitchPipelineFilter
{
public class PipelineFilterA : BeginEndMarkPipelineFilter<TextPackageInfo>
{
private static byte[] _beginMark = new byte[] { (byte)'Y' };
private static byte[] _endMark = new byte[] { 0x00, 0xff };
public IPipelineFilter<TextPackageInfo> SwitchFilter { get; }
public PipelineFilterA(IPipelineFilter<TextPackageInfo> switcher)
: base(_beginMark, _endMark)
{
SwitchFilter = switcher;
}
protected override TextPackageInfo DecodePackage(ref ReadOnlySequence<byte> buffer)
{
NextFilter = SwitchFilter;
return base.DecodePackage(ref buffer);
}
}
}

View File

@ -1,26 +0,0 @@
using System;
using System.Buffers;
using SuperSocket.ProtoBase;
namespace SwitchPipelineFilter
{
public class PipelineFilterB : BeginEndMarkPipelineFilter<TextPackageInfo>
{
private static byte[] _beginMark = new byte[] { (byte)'*' };
private static byte[] _endMark = new byte[] { (byte)'#' };
public IPipelineFilter<TextPackageInfo> SwitchFilter { get; }
public PipelineFilterB(IPipelineFilter<TextPackageInfo> switcher)
: base(_beginMark, _endMark)
{
SwitchFilter = switcher;
}
protected override TextPackageInfo DecodePackage(ref ReadOnlySequence<byte> buffer)
{
NextFilter = SwitchFilter;
return base.DecodePackage(ref buffer);
}
}
}

View File

@ -1,37 +0,0 @@
using System;
using System.Buffers;
using SuperSocket.ProtoBase;
namespace SwitchPipelineFilter
{
public class SwitchPipelineFilter : PipelineFilterBase<TextPackageInfo>
{
private IPipelineFilter<TextPackageInfo> _filterA;
private byte _beginMarkA = (byte)'Y';
private IPipelineFilter<TextPackageInfo> _filterB;
private byte _beginMarkB = (byte)'*';
public SwitchPipelineFilter()
{
_filterA = new PipelineFilterA(this);
_filterB = new PipelineFilterB(this);
}
public override TextPackageInfo Filter(ref SequenceReader<byte> reader)
{
if (!reader.TryRead(out byte flag))
throw new ProtocolException("Flag byte cannot be read.");
if (flag == _beginMarkA)
NextFilter = _filterA;
else if (flag == _beginMarkB)
NextFilter = _filterB;
else
throw new ProtocolException($"Unknown flag at the first postion: {flag}.");
reader.Rewind(1);
return null;
}
}
}

View File

@ -1,8 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(SamplesTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\SuperSocket.ProtoBase\SuperSocket.ProtoBase.csproj" />
</ItemGroup>
</Project>

View File

@ -1,16 +0,0 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "WebSocketPushServer.dll"]

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