Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling OPC UA over WebSockets (again) #1836

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 60 additions & 0 deletions Stack/Opc.Ua.Bindings.WebSockets/Opc.Ua.Bindings.WebSockets.csproj
@@ -0,0 +1,60 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(LibTargetFrameworks)</TargetFrameworks>
<AssemblyName>Opc.Ua.Bindings.WebSockets</AssemblyName>
<PackageId>OPCFoundation.NetStandard.Opc.Ua.Bindings.WebSockets</PackageId>
<RootNamespace>Opc.Ua.Bindings</RootNamespace>
<Description>OPC UA WebSockets Binding Library</Description>
<IsPackable>true</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<LangVersion>8.0</LangVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<PackageId>$(PackageId).Debug</PackageId>
</PropertyGroup>

<PropertyGroup Condition="'$(SignAssembly)' == 'true'">
<DefineConstants>$(DefineConstants);SIGNASSEMBLY</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net462|AnyCPU'">
<OutputPath>C:\Repositories\AC-LIC-Prototype - Sequencing - WebSockets\AC.LIC.Sequencing\bin\Debug\net5.0\</OutputPath>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<Reference Include="System.Net.Http" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.1.3" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this kestrel version is end of life -- check the https project how to use latest kestrel...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I just remove all Microsoft.AspNetCore.Server.Kestrel dependecies and add the new Microsoft.AspNetCore.Http dependency.

    <PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />

No code changes were required at all, the test results remain unchanged (when execting each test on its own):
image

<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Core" Version="2.1.25" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="2.1.3" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Opc.Ua.Core\Opc.Ua.Core.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.IdentityModel" />
</ItemGroup>

<Target Name="GetPackagingOutputs" />

</Project>
24 changes: 24 additions & 0 deletions Stack/Opc.Ua.Bindings.WebSockets/Properties/AssemblyInfo.cs
@@ -0,0 +1,24 @@
/* Copyright (c) 1996-2020 The OPC Foundation. All rights reserved.
The source code in this file is covered under a dual-license scenario:
- RCL: for OPC Foundation members in good-standing
- GPL V2: everybody else
RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/
GNU General Public License as published by the Free Software Foundation;
version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2
This source code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
using System.Runtime.CompilerServices;

#if SIGNASSEMBLY
[assembly: InternalsVisibleTo("Opc.Ua.Core.Tests, PublicKey = " +
// OPC Foundation Strong Name Public Key
"0024000004800000940000000602000000240000525341310004000001000100d987b12f068b35" +
"80429f3dde01397508880fc7e62621397618456ca1549aeacfbdb90c62adfe918f05ce3677b390" +
"f78357b8745cb6e1334655afce1a9527ac92fc829ff585ea79f007e52ba0f83ead627e3edda40b" +
"ec5ae574128fc9342cb57cb8285aa4e5b589c0ebef3be571b5c8f2ab1067f7c880e8f8882a73c8" +
"0a12a1ef")]
#else
[assembly: InternalsVisibleTo("Opc.Ua.Core.Tests")]
#endif
@@ -0,0 +1,46 @@
/* Copyright (c) 1996-2016, OPC Foundation. All rights reserved.

The source code in this file is covered under a dual-license scenario:
- RCL: for OPC Foundation members in good-standing
- GPL V2: everybody else

RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/

GNU General Public License as published by the Free Software Foundation;
version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2

This source code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/

using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Net.Security;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Net;
using System.Security.Cryptography;

namespace Opc.Ua.Bindings
{
internal class SendRequestAsyncResult : AsyncResultBase
{
public uint RequestId;
public WebSocketConnection Connection;
public IServiceRequest Request;
public IServiceResponse Response;
public Task WorkItem;
public new CancellationToken CancellationToken;

public SendRequestAsyncResult(AsyncCallback callback, object callbackData, int timeout)
:
base(callback, callbackData, timeout)
{
CancellationToken = new CancellationToken();
}
}
}