kerryjiang / WebSocket4Net

A popular .NET WebSocket Client
Apache License 2.0
770 stars 274 forks source link

PCL support #14

Open coding-chick opened 10 years ago

coding-chick commented 10 years ago

Is it possible to add a PCL support for WebSockets? Or is it platform dependent?

EdHubbell commented 10 years ago

Even though this library is platform dependent, PCL support should be possible using the Bait and Switch PCL trick (details at http://log.paulbetts.org/the-bait-and-switch-pcl-trick/). At least that's my understanding. I don't have access to Visual Studio, which would be the easiest way I know of generating the necessary abstract classes.

And all that said, my understanding of how to implement this is VERY shallow. I may not be correct on any of it.

RReverser commented 9 years ago

Yes, please!

kerryjiang commented 9 years ago

Is there anyone can join me to do this job? I am working on many different open source projects, so I don't have enough time for all the tasks. It should be difficult because you don't have System.Net.Sockets.Socket class in some runtimes like WinRT and WP8.1+.

RReverser commented 9 years ago

No, but in Win8.1/WP8.1 there is native MessageWebSocket class (client-side WebSocket) that can be wrapped with your library.

kerryjiang commented 9 years ago

Probably it is good idea to encapsulate MessageWebSocket in WebSocket4Net(WinRT) to keep the consistent API for all the platform. But it cannot be a PCL library then.

RReverser commented 9 years ago

@kerryjiang Why not? It can through the Bait-and-Switch trick mentioned above. There is another one good explanation on it here: http://www.guruumeditation.net/bait-and-switch-pcl-explained

kerryjiang commented 9 years ago

@RReverser Nice trick, it seems I should have a try.

RReverser commented 9 years ago

@kerryjiang :+1: Just please note that MessageWebSocket-based part should be marked not just for WinRT (Windows 8.1) but also for Windows Phone 8.1 so it could be used in Universal Apps.

yufeih commented 9 years ago

Or you can take a look at https://github.com/DDReaper/Piranha, that'll create a PCL based on a couple of platform dependent dll files.

kerryjiang commented 9 years ago

Oh, it seems only a trick of NuGet? I mean Bait and Switch PCL trick.

deus42 commented 9 years ago

Do you have any updates? i'd like to make PCL w/ web sockets for xamarin and windows 8.1, but installing WebSocket4Net I get an error that don't have package for Profile=111:

"Could not install package 'WebSocket4Net 0.13.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111' "

RReverser commented 9 years ago

@kerryjiang Yes.