简体   繁体   中英

Can I use SignalR in my Winform c# app?

I have a web service being polled every few seconds in my winform c# app. It checks for messages and gets them from my server and/or it relays messages from my desktop app to my server.

The web service is being invoke in an infinite loop which the User can stop and start at the click of a button. When the polling is on the memory goes up and stays up (which I guess I expected using infinite loop). If there was way for my server to notify my client that a message is available then I assume I can get rid of my infinite loop. I was looking at different architectures and I came across SignalR but it seems more geared for asp.net. Is that the case? Or can it be modified to work in my scenario here?

thanks

Using SignalR as a client (or server) requires win8+ to get websockets. That should be something you are very aware of before using it. I learned the hard way ;) See support here http://www.asp.net/signalr/overview/signalr-1x/getting-started/supported-platforms

See this answer about boosting asmx/WCF to become a push service in 2 lines of code. Push Data from a WCF Service to Website

There is a .NET client for SignalR, also you can self host SignalR using Owin

Install package

Microsoft.AspNet.SignalR.Client

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM