Can we create Server in desktop application using SignalR? - c#

I need to develop desktop application as a Server using SignalR. I want to know SignalR is only for ASP.net webapplication or it can be used as Desktop application?
On SignalR client side, SignalR provides client libraries for .NET, JavaScript, Silverlight, Windows Phone, Windows RT and even iOS and Android through Xamarin.
On server side, can we make Server in desktop application using SignalR? SignalR possible in visual studio 2010 or higher version?

Yes you can.
What you are searching for is named "SignalR Self-Host"
Tutorial from Microsoft:
http://www.asp.net/signalr/overview/deployment/tutorial-signalr-self-host
Tip:
Use Win8 or Win2012 for the host for WebSocket support.

Related

Communication channel between a windows app and UWP app

I have a uwp project and a windows app (net5).
Both are installed in the same machine (same will happen in production), but the uwp is installed using sideloading, not on windows store.
The windows app gets some data by listening to a wss port. I have to pass those data from the windows app to the uwp app and also wait for a response back from it.
To do this internal communication I came across the AppServiceBridgeSamples in this repo https://github.com/microsoft/DesktopBridgeToUWP-Samples but it is outdated and I can't use it.
Is there any alternatives to it? What would be the easiest implementation to achieve this?
Any suggestions/comments are appreciated.
Currently, the general way to implement a communication channel between a UWP app and a windows app is by using App service. This is not outdated. If you don't want to use the App service, you have to build your own socket server so that both of your apps could communicate with it. Another way is that your windows app could save the data in a local file and load them in the UWP app.

Authentication and Authorization in Local Network UWP Apps

I want to develop a (Universal Windows Platform) UWP app that will run locally. But another requirement is that 2 or more of the same UWP apps will be on another PC as a client. In the same local network, the database will be using sharing across all devices.
And of course, authentication and authorization will be needed on my UWP App.
I've done those in Web Apps using supported libraries according to the used language. But no idea how to implement it in UWP and local-network applications.
I've targeted to use UWP C# and MySQL database.
What would be the architecture of the App and popular tech stack to use because I'm not familiar with the C# world? Thank you very much.

Xamarin Forms App as TCP Server

I have a cross-platform Xamarin.Forms app (iOS and Android) which provides a specific service. This service code is in PCL part of the project and I want to use it on web client as well using my app as server. Is there a way to implement TCP server in the app which listens to incoming connections and provides with the service.
Do I have to use platform specific background services to run TCPListener? The server should only be running when the app is in foreground.
I have tried to look for answers over forums and got bits and pieces.
All I need right now is right direction to go to:
Server Client Application with .NET and Xamarin
Xamarin.Forms Background Thread
Sockets PCL Plugin
Any kind of help is highly appreciated.
Cheers.

Converting a C# app using long poll to use Websockets on windows 7

I have an existing desktop application that uses long polling to receive notifications to use websockets. My development is on Windows 7 I have a websocket server running out on our network. When I would like to replace the notifications to use websockets, and this only needs to be a listen only.
I everything I find says websockets are only available on Windows 8.
Is there no way to create a listen only websocket connection to an existing web socket server?
If windows 8 is only development, can it be build on windows 8 then deployed to a Windows 7?
Is there a work around that does not involve third party installation?
I am afraid not. System.Net.WebSockets is not supported on Windows 7. So if you try to run an application that uses that namespace, no matter if it is server or client, it will throw a PlatformNotSupportedException.
You will need to install a third party client to be able of connecting to a WebSocket server.
Take a look at
https://github.com/sta/websocket-sharp
https://github.com/Olivine-Labs/Alchemy-Websockets-Client-Library
http://websocket4net.codeplex.com/

How to setup a Websocket connection on Windows Azure?

Does Azure support the use of WebSockets for .NET, if so how can a Websocket connection be initiated and handled?
Web Sockets are now supported in Azure Web Sites. To use them, go to the site Configuration page in the management portal and turn on Web Sockets.
At the moment this isn't possible. You'll only get websockets when Azure (Cloud Services or Web Sites) supports .NET 4.5 on Windows Server 2012 (IIS8), which isn't the case at the moment.
Today .NET 4.5 is only available in Web Sites with Windows Server 2008 R2 (IIS7).
Note: Technically you can use other solutions (as opposed to IIS) to get websockets in your Azure application (like Pokein, SuperSocket, ...)
As Sandrino says this is not possible unless you have win8/2012 with .net 4.5.
However, that´s if you are running SignalR (or WebSockets in 4.5 of course).
We have been using websockets on Azure for quite some time now, and it is working really well.
You can try it at http://live.xsockets.net or our really simple playground http://xfiddle.net
Regards
Uffe

Categories