How to push data from asp.net to flash/silverlight client? - asp.net

I'm developing chat application. I use flash as front end and asp.net back-end. My question is: can my asp.net web app send data to flash app in browser without post back ?actually it mean asp.net push data to flash client. I don't know much about flash or siverlight, dose flash support to do that ? or other way help me connect direct from server to browser without using post back or Jabber ? Please give me your advise, thanks so much !

Here is the 100% solution, called Diffusion sever:
http://demo.pushtechnology.com/docs/manual/apis/flash/index.html

This is another option for you written by people at Microsoft:
http://laharsub.codeplex.com/
We use it and so far so good. Very fast.

No, the server cannot push data to the client without postback. It's the client application that needs to fetch it from the server. In fact there's the WebSocket API draft in HTML5 that allows the server to push data to the client but it still has limited browser support and you will need a server that is capable of handling this protocol.
So currently the only reliable way of doing this is by having the client poll the server for data.

Flash has support for socket communication, that can be used to push data to the client without polling.
You mention asp.net, I'm no expert in that area, but maybe the "Active Server Pages" aspect doesn't fit so well with socket communication, but I'm pretty sure you can build the server side of a chat, pushing data via sockets, in .Net.

Related

How can I communicate between a server and client in a ASP.NET webapp?

I want to make a pictionary like webapp.
I chose to develop using the .net platform, and decided to make a blazor client with a asp.net server, but I don't know how to communicate between them.
When a player is drawing something, as he/she draws, whatever he/she is drawing should appear on the other player's client, but I don't know how should to send this data to the server and back to the other clients.
I took a look at gRPC but don't know if this is the right tool for this kind of communication assuming a tickrate of 20 to 50 times a second.
You may create a Blazor WebAssembly App, which is running on the browser, and whose default means of transport is HTTP. However, you can use SignalR Client for your requirements. This is the way to go. Look up in the docs for the sample of creating a chat app in Blazor WebAssembly employing SignalR Client. There are also code samples created by the community demonstrating how to create advanced chat applications and games, and every thing involving that.
Good luck...

Can i propagate applications insight clientside telemetry through the webserver?

I realize a similar question has been asked here. Although it talks specifically of a custom domain, whereas i would want to send the data from the clients to the webserver where the serverside SDK is running and then send it from there. Is there any way to do this? We have PCs which will be stripped of direct internet access, however the webserver will not.
I think the answer from #John Gardner applies here - you need:
1. Send data from your app to your server/web server
2. In web server send data to Application Insights

How to Design a Database Monitoring Application

I'm designing a database monitoring application. Basically, the database will be hosted in the cloud and record-level access to it will be provided via custom written clients for Windows, iOS, Android etc. The basic scenario can be implemented via web services (ASP.NET WebAPI). For example, the client will make a GET request to the web service to fetch an entry. However, one of the requirements is that the client should automatically refresh UI, in case another user (using a different instance of the client) updates the same record AND the auto-refresh needs to happen under a second of record being updated - so that info is always up-to-date.
Polling could be an option but the active clients could number in hundreds of thousands, so I'm looking for a more robust and lightweight (on server) solution. I'm versed in .NET and C++/Windows and I could roll-out a complete solution in C++/Windows using IO Completion Ports but feel like that would be an overkill and require too much development time. Looked into ASP.NET WebAPI but not being able to send out notifications is its limitation. Are there any frameworks/technologies in Windows ecosystem that can address this scenario and scale easily as well? Any good options outside windows ecosystem e.g. node.js?
You did not specify a database that can be used so if you are able to use MSSQL Server, you may want to lookup SQL Dependency feature. IF configured and used correctly, you will be notified if there are any changes in the database.
Pair this with SignalR or any real-time front-end framework of your choice and you'll have real-time updates as you described.
One catch though is that SQL Dependency only tells you that something changed. Whatever it was, you are responsible to track which record it is. That adds an extra layer of difficulty but is much better than polling.
You may want to search through the sqldependency tag here at SO to go from here to where you want your app to be.
My first thought was to have webservice call that "stays alive" or the html5 protocol called WebSockets. You can maintain lots of connections but hundreds of thousands seems too large. Therefore the webservice needs to have a way to contact the clients with stateless connections. So build a webservice in the client that the webservices server can communicate with. This may be an issue due to firewall issues.
If firewalls are not an issue then you may not need a webservice in the client. You can instead implement a server socket on the client.
For mobile clients, if implementing a server socket is not a possibility then use push notifications. Perhaps look at https://stackoverflow.com/a/6676586/4350148 for a similar issue.
Finally you may want to consider a content delivery network.
One last point is that hopefully you don't need to contact all 100000 users within 1 second. I am assuming that with so many users you have quite a few servers.
Take a look at Maximum concurrent Socket.IO connections regarding the max number of open websocket connections;
Also consider whether your estimate of on the order of 100000 of simultaneous users is accurate.

Is it possible to implement Database backed Push Notifications in ASP.NET WebAPI

I'm working on a client and server application, in which client requests 'client-specific' data from the server. I'm planning on switching to ASP.NET WebAPI for server so that client can take advantage of available .NET APIs to query server for data.
This scenario works perfectly fine when the client initially connects and requests data from server, However, instead of client constantly polling for data, it should just establish a persistent connection and the server should be able to monitor the database for changes and push new data to the client that has stale data. I came across SignalR and found that it can be used with WebAPI, but can't figure out how to integrate it with database monitoring i.e. a thread or process that is constantly monitoring database for updates. Any solution? I'm open to other non-WebAPI based .NET technologies as well - basically anything .NET based that will cut-down on the development time.
ASP.NET Web API supports PushStreamContent. Take a look at the section "Push Content" in http://blogs.msdn.com/b/henrikn/archive/2012/04/23/using-cookies-with-asp-net-web-api.aspx. Here, a timer triggers content written into the stream but you can use that to poll database and write into response or build some other better mechanism
signalR could fit your requirement. You can broadcast a message to all your user or just to part of them. Your client could be a browser (with javascript) or a .net client (WPF or else).
From the server, you can call a method on the client just like that
Clients.All.MyMethodOnTheClient(param1, param2)
or
Clients.Client(connectionId).MyMethodOnTheClient(param1, param2)
The topic is too broad to answer it in 5 min. I can advise you to start here.
Then browse the server api guide, the javascript guide and the .net client guide.
Don't worry. It's quite fast to have a complete tour.

How to work when internet connection down?

How to work when internet connection down in a asp.net application ?
Means Users are working on application and suddenly internet connection down then user should still be able to add/edit/ delete operation on data, but when internet connection is up then
all changes should be done at server. Is that possible, Is there any example available to achieve this?
Thanks.
HTML5 has some offline capabilities. http://www.html5rocks.com/en/features/offline
But do you really have a business case for this? It will get complicated when you need to try and update stale data etc.
This requires use of JavaScript to store local data http://code.msdn.microsoft.com/Working-with-HTML5-local-b0cbe2ef and it needs to check whether the server can be reached before doing a proper postback, or more likely just use AJAX to communicate between the JavaScript application and the server.
There are several applications like this such as Google Mail, and such solutions are more JavaScript based than ASP.NET and you need to avoid relying on the web forms mechanisms and use .NET for building the initial page, dealing with AJAX requests and managing the application data and persistence. See How to write an offline version of an AJAX/ASP.NET web application

Resources