Is Function execution continues in web api, when client is closed? - asp.net-core-webapi

Scenario: After making a call from client to web api, and client is closed(like browser is closed) will the functionality continues on the server? As there is no client to accept the response, what will be the situation? will the functionality stops as the client is closed, How it happens? If the functionality continues, how to stop it? As no one will be willing utilize the resources for a closed client.

Related

What's the best pattern/strategy for guaranteeing message delivery via SignalR MVC Web application?

I'm investigating possible existing patterns for helping guarantee message delivery.
I know SignalR is basically fire and forget, but we need to guarantee/ack delivery to client.
We are not (don't want) to use any backend datastore (folks here are concerned with performance). We will not have a super high volume of messages (like a trading app).
The hub is hosted directly in MVC Web app. We don't have to resend messages lost after reconnection (client get's full refresh of data). Current scale out plans for the near future is to have 2 servers behind a load balancer.
I guess another question I have is that when a client sends ACK back to server, will it go to the correct server behind the load balancer?
Thoughts/advice?
Thanks,
JohnB

blazeds,how to know the client has "disconnected"?

The blazeds server-side don't know the client-side has disconnected. But it seems to know the client-side's network has down.
In my case, I use the polling channel, I download the blazeds's source code, and add some log output in the FlexClientOutboundQueueProcessor.flush(MessageClient messageClient, List<Message> outboundQueue) method.
Then I saw this, when a client subscibed, the server-side invoke the FlexClientOutboundQueueProcessor.flush method every 3 seconds, and print what I added in the flush method, then I only shut down the client's network, not close browser(client and server with difference network), I found the server-side don't print anything, it means that the server-side don't invoke the flush method.
And after more than 30 minutes I recover the client's network, the server-side continue to invoke the flush method (the client's session isn't destroyed, if I close the client's browser, after 30 minutes the server-side will destroy the session).
Now, I have two questions,:
How the server-side know the client's network has downed? Is there a listener to monitor the client's network? If so, where is it? If not, how and where the codes?
It seems that the server-side will invoke the FlexClientOutboundQueueProcessor.flush method every 3 seconds, can this interval be configured? And where the code to start or stop this timing task?
Here answer on your first question: Detecting (on the server side) when a Flex client disconnects from BlazeDS destination
About configuration. You can configure in services-config.xml.
Example BlazeDS applications
Configuring channels with servlet-based endpoints

Is polling the way to go for live chat on web?

I'm trying to implement a custom live chat program on the web, but I'm not sure how to handle the real-time (or near real-time) updates for users. Would it make more sense to send Ajax requests from the client side every second or so, polling the database for new comments?
Is there a way to somehow broadcast from the database each time a comment is added? If this is possible how would that work? I'm using Sql Server 2008 with Asp.net (c#).
Thanks!
Use long polling/server side push/comet:
http://en.wikipedia.org/wiki/Comet_(programming))
Also see:
http://en.wikipedia.org/wiki/Push_technology
I think when you use long polling you'll also want your web server to provide some support in the form of non-blocking io for requests, so that you aren't holding a thread per connection.
You could have each client poll the server, and at the server side keep the connection open without responding.
As soon there is a message detected at server side, this data is returned through the already open connection. On receipt, your client immediately issues a new request.
There's some complexity as you need to keep track server side which connections is associated with which session, and which should be responded upon to prevent timeouts.
I never actually did this but this should be the most resource efficient way.
Nope. use queuing systems like RabiitMq or ActiveMQ. Check mongoDB too.
A queuing system will give u a publish - subscribe facilities.

Flex client disconecting

I am using BlazeDS. Does anybody know how to disconnect client from server? Client must be informed about this event.
Thanks for help.
As far as I knew BlazeDS does not support open connections between the Flash Player and the server. You'll have to use LiveCycle if you want to do that.
When you make a server call using the HTTPService, WebService, or RemoteObject tags, there are events that fire when you receive feedback from the server, such as result or fault. When those events fire, you can safely assume that that service call is no longer connected ot the server.

What TCP protocols are usable for client to client communication?

Manytimes clients ask for features like instant messaging (IM) and other client-to-client (P2P) communication for their web apps. Typically how is this done in normal web browsers? For example I've seen demos of Google Wave (and Gmail) that are able to IM from a regular browser. Is this via HTTP? Or does XmlHttpRequest (AJAX) provide the necessary backend for such communication?
More than anything I wonder how can a server "wake up" the remote client, lets say for sending an IM? Or does the client have to keep "polling" the message server for new IMs?
Typically the browser will poll the server for new messages. One approach that is often done to make this more efficient is the 'long poll' (see also this link) - the server responds immediately if it has anything; otherwise, it waits, keeping the connection open for a while. If a message comes in, it immediately wakes up and sends it, otherwise it comes back with a 'nope, check back' after a few tens of seconds. The client them immediately redials to go back into the long-polling state.

Resources