WPF / WCF Push Notification - wcf

Does .NET 3.5 (WCF, or other) offer any type of push notification service?
I have a server and a client. I want a service to run on the server and if x happens then push a notification to the client. I don't want to pull the server every x minutes to gather the information.

Your question couldn't be any more general, but I'm going to take a guess and suggest you look at WCF callbacks.
I doubt your question relates to WPF or even WF, but you will need to elaborate if you think otherwise.

You don't need to use any call backs.
You can use MSMQ with WCF.
You can use the attached example I have made.
If you sent it to be a public push server - i.e available via WebService - you will have to add a webservice that will use the MSMQ.
The problem is that you will need to have an IIS installed on both the server and the client.
If you use it internally then MSMQ will be enough.
http://www.codeproject.com/KB/WCF/WcfMsmqServerPush.aspx

Related

WCF Service CallBacks

On WCF callbacks, one doubt is still nagging in my mind, The callback happens only when the client makes a call to the server. Don't we have a mechanism that the client registers with the service, and after a while something happens at the server and the service notifies all the connected clients. In COM we do this by generating a COM exe server and keeping a list of all connected clients and trigger an event whenever the COM exe server deems necessary and that will end up as a callback at the client end.
Are you really looking for a messaging implementation like MSMQ?
Using MSMQ, you can setup your client to be a subscriber to your server's "messages". The server in turn is your publisher and it will produce the effect you seem to desire.
http://msdn.microsoft.com/en-us/library/ms711472(v=vs.85).aspx
You want to look at Duplex WCF bindings...
http://msdn.microsoft.com/en-us/library/ms731064(v=vs.110).aspx
http://msdn.microsoft.com/en-us/library/ms752254.aspx
Another framework you may want to evaluate is NServiceBus ...
http://docs.particular.net/NServiceBus/how-pub-sub-works

Push Notifications From Server To Client With WCF (or similar)

I am sure that this is answered dozens of times, but I am at a loss as to what keywords to search for and thus I hope that someone can at least tell me where I should be looking given an explanation of my scenario.
I need two services (one can be just a client if that is easier) to talk to each other, but the client will be on a private network whereas the server will be on the internet. I want to be able to push jobs to the client, but the server obviously does not have an IP to hit the client. I'd rather not poll from the client every X seconds. I have read various topics all circling this issue and so I am going to throw out a few terms that I think are relevant, but I am not sure which to use or exactly how.
Comet, SignalR, WebSockets, XSockets, Publisher/Subscriber Pattern...
I have looked at each of these and I am not sure which is the right way to go. The client can certainly "subscribe" to the server on startup, so that should not be an issue. But the client should be either a console app, windows service, or WCF service. It seems Comet and SignalR are more for ASP.NET apps, where the client is JS in a browser. I just need "server(client)" to server connection where the client is behind firewalls.
Which of these terms (or none of them) is a good way to handle server -> client push notifications?
Pub/Sub architecture pattern with something like Azure Service Bus should help you create the solution you desire. This does require that service and the client are aware of the bus. For the plumbing of the client and the services use the WCF which has built in bindings to facilitate the use of this pattern.
Azure: How to Use Service Bus Topics/Subscriptions.
Azure SB has a counter part that works on-premises as well. There are other popular message bus tech (NServiceBus, MasTransit, etc.)
You can have a look at node.js together with socket.io.
This will give everything you need.
socket.io uses web sockets, and if the browser does not support web sockets, it gracefully falls back to other communication mechanism like xhr, flash, polling, aso.

Improving performance of WCF services working with real time data

In my application I need to push notifications of real time events from server to clients. The amount of data to pass is very small, mostly and Id. The number of clients listening simultaneously can be around 100 and I may have to publish one notification every 2 - 3 seconds. Both the server and client are built using .Net and WCF.
Given these requirements I have built a set of WCF services which will be run on a load balanced server cluster. The Instance context mode is Per Call and there is no need for sessions etc.
I am currently using BasicHttpBinding. Will TCP binding be better? Does it run on IIS 5 or 6? If not why?
What configuration for serialization can work best?
What are the things I need to do to make sure I get maximum performance?
Edit - Adding more information based on some of the responses -
I host a small WCF service in the client process using manual hosting. The server just calls this service on each client to push the data to all of them.
Firstly have you considered using messaging for what you are trying to achieve?
In answer to will TCP binding work better than BasicHttpBinding- almost certainly yes. If you want to use TCP, you can't use IIS- look into WAS with Windows Server 2008. If you're stuck with Windows Server 2003, then you'll have to host in a windows service instead.
You've made a good choice by choosing per call- this is the preferred instance management mode for creating scalable WCF services.
Edit:
Now you've update your question, I recommend you take a look at IDesign's Pub/Sub framework if you want to stick with WCF. I'd also look at Pub/Sub with MSMQ in WCF and also with "Vanilla" products such as Tibco RV.
If you need pushing data from service to clients you need sessions and you need duplex binding - NetTcpBinding or WSDualHttpBinding. It will not work with BasicHttpBinding because it allows only pulling data (client pools the service for changes). Push data means tha service sends data to clients when needed.
NetTcpBinding always crete session. It can't be hosted in IIS 6 or older. NetTcpBinding is allowed only in Windows Activation Service (WAS) which is extension of IIS 7.x. For older systems you need self hosting = windows service.
Edit:
Based on your description you need Publish-Subscribe message exchange pattern.

Event Dispatcher for WCF call-backs

I have a server that needs to keep a small number of clients in sync. Whenever there is a change of state at the server, all the connected clients must be informed.
I am planning to use a “callback
contract”,
I can get hold of the
callback reference for each client on
the server by using
GetCallbackChanel().
I then need
to manage all these client channel
reference and call all of them when
needed.
So far so good however:
I don’t wish to block the server, so calls to the clients must be none blocking
Errors calling the client must be logged and coped with
Is there a standard WCF component to do this?
No, there is not a standard WCF component for this, at least through .NET 3.5. I can't speak to what may be available in .NET 4.0.
That said, there is a pretty straightforward way to do this. Juval Lowy, author of Programming WCF Services, describes how to do this using his WCF-based Publish-Subscribe Framework.
Basically, the idea is to create a separate WCF event service that resides in the same hosting application as your server (e.g., Windows service, IIS). When the state of your server changes, you publish the state change to the event service. The clients that need to be kept in sync subscribe to this same event via the event service. In effect, the event service becomes a broker for your server to notify clients of whatever events your server publishes.
The article I listed above has a code download, but you can also get the Publish-Subscribe Framework and a working example for free from his website, IDesign.net. Here is the link to the download. You may need to scroll your browser up just a little bit to see it as I believe their internal hyperlink is wrong.

netmsmqbinding with silverlight connections limit

I have develop a silverlight chat application. my question is (a) can netmsmqbinding support unlimited connections of wcf service. because first im use pollingduplex binding but it support only 10 connection on iis6 also on server edition.im allready set service throttling options but not effect on server iis. so that now i want to go for netmsmqbinding. please explain me msmqbinding limitations.can its better for chat application or not?
help me for take decision.
Thanks
As far as I know (but I don't know Silverlight all that well), it supports only the basicHttpBinding.
And even if Silverlight did support MSMQ - this is definitely not a good protocol to use when you're creating a chat application. The queue can buffer messages and deliver them later. That works well in many scenarios, but when I chat with someone, I want my message to show up right away - not "some time later".....
So if you really need to use MSMQ in some way, I think you'd have to have a BasicHttp-based front-end service that goes from your Silverlight client to the server, and then on the server actually route your message forward to a MSMQ queue.
Marc