WebSocket4Net icon indicating copy to clipboard operation
WebSocket4Net copied to clipboard

PCL support

Open coding-chick opened this issue 11 years ago • 12 comments

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

coding-chick avatar Jul 11 '14 22:07 coding-chick

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.

EdHubbell avatar Oct 25 '14 13:10 EdHubbell

Yes, please!

RReverser avatar Dec 09 '14 14:12 RReverser

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+.

kerryjiang avatar Dec 09 '14 17:12 kerryjiang

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

RReverser avatar Dec 09 '14 22:12 RReverser

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.

kerryjiang avatar Dec 09 '14 22:12 kerryjiang

@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

RReverser avatar Dec 09 '14 22:12 RReverser

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

kerryjiang avatar Dec 09 '14 22:12 kerryjiang

@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.

RReverser avatar Dec 09 '14 22:12 RReverser

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.

yufeih avatar Jan 15 '15 10:01 yufeih

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

kerryjiang avatar Aug 17 '15 11:08 kerryjiang

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' "

deus42 avatar Sep 03 '15 16:09 deus42

@kerryjiang Yes.

RReverser avatar Sep 03 '15 17:09 RReverser