Silverlight notification from server to all clients without UDP - silverlight

I wonder how can I achieve this without UDP, I have a solution using UDP multicast: http://blogs.msdn.com/b/ncl/archive/2009/11/18/udp-multicast-in-silverlight-4.aspx
but since this is for a high profile customer who has an intranet with port TCP 80 and TCP 8080 only enabled this solution is not possible. Yes, the application runs in an intranet environment.
I need a simple example how to send messages to all Silverlight clients over WCF.
I found this solution, but I have no idea how to implement that into Silverlight:
http://idunno.org/archive/2008/05/29/wcf-callbacks-a-beginners-guide.aspx
I'm out of ideas guys, please help.

Instead of receiving notifications async the Silverlight client should use polling instead.
It can poll a WCF service that will fetch the data from a db...
This is the typical solution. Anyway, you have to handle the case in which the Silverlight client wasn't online and then it becomes online and need to know its state...
However, if you still want Silverlight to receive async notifications try searching for 'Full Duplex'.
Here are some starting points:
http://blog.developers.ba/post/2009/02/25/Silverlight-chat-application-using-WCF-full-duplex.aspx
http://weblogs.asp.net/dwahlin/archive/2008/06/16/pushing-data-to-a-silverlight-client-with-wcf-duplex-service-part-i.aspx
http://hindams.wordpress.com/2010/04/05/wcf-full-duplex-with-a-silverlight-application/

Related

How to build serverless p2p chat application in React?

I would make a chat app where server communication is allowed only for signaling.
I checked this video: https://www.youtube.com/watch?v=WmR9IMUD_CY
This video goes about "real time" communication, for me some delay is ok. I would make chat application which only send text, but not video content. The question raised for me:
How to generate ice candidates to get list ip addresses / ports? How to make request to stun server?
If we have the ip and port list shared through the signaling server on both side, then how one client call the other client and send or receive text? Can I use axios for sending, and set one of the ip - port pair from the list as url? How to receive message?
Maybe I do not even need webrtc as the data transmission does not need to be realtime, some delay is ok?
Would you show a basic demo?
Maybe that is what you are looking for Google Code Lab Friendly Chat
but if you want to learn more about WebRTc I really recommend this article so you will can see if is that what you want.

how to send and recieve notification using WPF and WCF

I am using WPF and WCF for client server application. but i got a problem.
How to notify any update of client to other client.
Server(WCF)
Client1(WPF)
Client2(WPF)
if client1 enter any new record,immediatly notification send to client2 .
please suggest me best way to this complete task.
Thanks..
We have achieved such a requirement by using WCF Duplex Services. You can find enough information by googling about implementing a duplex service.
Basically;
clients send a client identifier (uniquely generated for each client) while registering to duplex service.
when WCF service updates data, pushes an update notification (including the notification source's client identifier) to all the registered clients
clients check for the originator's identifier when they got a notification. Discarding notifications caused by itself.
A few notes:
You can include everything about the updated data inside pushed notification payload to understand the change type or entity type.
Different bindings supported by duplex services. Usage of nettcpbinding is suggested if clients and service are in the same network and .net dependency is not a problem. You can find more information about support binding types from here or here.

Reconnecting WCF clients after a service receive timeout has occured

I have a WCF service which I host inside a WFP application, which acts as one of the clients of service as well. There is one more WPF app which acts as another client for service. After a timeout occurs and clients get disconnected, What is the proper way to clean up resources and connect the clients again. I am trying to create new proxies but I am not able to use them for communication. I know I can increase the recieve timeout on service but I need my clients to be able to communicate always not just for long enough. I have also tried continously sending a message to service at interval but that's something I don't want to go for. What approach is best for continous communication between clients and service? My service might need to be connected to clients for months or may be years.
Any help will be of great value.
Thanks in advance.
You can catch the CommunicationException or something like that and then restore the channel.

Raw socket listening to a REST Channel in Silverlight

I understand how I can use a raw socket to listen to a server application and recieve information but I need an easy to access API and I am very familiar with REST.
Is there a way to push (not by using long pooling) data using a WCF service?
Here's my idea of how things should happen, at least at the begining:
The client accesses a URI with it's access parameters (ip, port, apikey).
The server responses with success/failure.
The server opens a socket for each channel with the client's details.
The server accesses a URI indicating that all channels are now streaming.
But how do I wrap the client or the server socket to access a URI?
Edit:
Maybe I should open a socket that notifies about changes on a channel and on the client side require that it will listen and raise the event accordingly.
This is not a very generic solution isn't it?
You should look into the Net.TCP binding, as described by Tomek (one of the WCF team members) here. You use it more-or-less like you would use the HTTP Duplex binding (i.e., the HTTP Long Poll), but it's much, much faster. It's still more complicated than REST, but it's dramatically easier than sockets, and I don't think you'll find a REST-type solution that does what you need.

Can I implement callback from WCF based HTTP service to a gSOAP c/Linux client?

I have a Linux/c client app that connects to a WCF web service over HTTP/SOAP (BasicHTTPBinding). I am using gSOAP. Can I implement the calls to the web-service using callback? I want to get the data asynchronously as call back.
Update: I have updated the question title.
WCF does support Duplex services, or those that have the ability to call back to the requesting client. Duplex services can be very complicated, as they are not only stateful, but they impose an contract implementation requirement on their clients.
Duplex services require the use of the WSDuplexHttpBinding. You will need to make use of the OperationContext to get a reference to the callback channel. Your clients MUST implement the callback contract in some class, and provide an InstanceContext that contains an instance of the callback class to the client proxy. Communications in both directions must be supported, and if the client is behind its own firewall or across the internet, this can be a complicated matter to resolve. Take care when writing duplex services...they are often more trouble than they are worth...so make sure you really need it. ;-)
The following page might be helpful:
http://msdn.microsoft.com/en-us/library/ms731064.aspx
The basicHttpBinding does not support callbacks. Another approach might be to have another method that the client can poll on for the response.
I am facing the same issue and the approach I am trying is to have a pair of gsoap servers/clients. Basically each process will listen on a port for soap calls and make its client calls to the other server. This way I avoid the polling or other complex approaches. The code has to be obviously thread safe for whatever business logic is implemented but the client/server combo pair is the simplest solution i have thought of so far.
Obviously one needs to be in control of both sides of the solutions the mentioned server and the mentioned client.

Resources