deniszykov / WebSocketListener

A lightweight and highly scalable asynchronous WebSocket listener
http://vtortola.github.io/WebSocketListener
81 stars 17 forks source link

'RegisterRfc6455' is not a member of 'WebsocketFactoryCollection' #58

Closed renatosc closed 3 years ago

renatosc commented 3 years ago

Hi. Thanks for you work in this project.

I installed your library via nuget and I am using it on a VB.NET .NET Framework 4.8. When trying to follow your sample, I get the error 'RegisterRfc6455' is not a member of 'WebsocketFactoryCollection' on the line: options.Standards.RegisterRfc6465()

Any idea why?

deniszykov commented 3 years ago

Hi @renatosc! RegisterRfc6455 is extension method in vtortola.WebSockets.Rfc6455 namespace try to add this namespace before use. You could also look for example project for basic setup.

renatosc commented 3 years ago

Thanks @deniszykov and sorry for my late reply.

Yeah, I made sure to import that and I was thinking it could be just some bug in Visual Studio that it was not getting your extension (I was using the original vtortola and had it replaced with yours due to my need to TLS 1.2 - btw, that is how I found your repo; from your answer to tls issue in the vtortola repo).

I cleared Visual Studio cache and even tried on a different machine but for an unknown reason Visual Studio is not recognizing the extension on my 4.8 .NET Framework VB project as you can see in the image below: image

you can see that I can use the WebSocketFactoryCollectionExtensions.RegisterRfc6455(options.Standards), so the namespace is loaded.

Also I noticed that this is happening to all extensions (such as webSocket.WriteStringAsync("Hello World!");).

I also created a new C# project with those same lines and everything worked fine, so I am only seeing that issue of extensions not being recognized on VB projects.

renatosc commented 3 years ago

An update: If you download the source code from github and add the projects as references (or just the DLLs created by the projects) and not use the nuget package then all extensions works fine with VB. So, this can be a work-around if anyone sees this problem.

deniszykov commented 3 years ago

Thanks @renatosc for finding you workaround. Actually I don't know why VB didn't see extensions methods.