Client unexpectedly shutdown - client-server

I am working on a .net rich client server application, the client call the server thru web service, what could happen if the client is suddently shutdown(connection closed) when it is calling the server? will the server be able to dectect this?
If the client is submitting a request to persist a set of data to server database, will the transaction still run?
Thanks in advance

try it. Make a web service call and then pull your internet cable.

Related

In a Web API call, if the server's reply didn't get to the client, will the server know?

A client, such as a C# program, invokes a server via its web API. The server process that is invoked does some database changes, then returns some data to the client, and the web API call finishes.
Suppose the response fails on its way to the client - for example the client dies and therefore the response can't be transmitted to the client.
In this case, will the server process get an exception from the operating system, so that it can rollback the database changes, or will the server happpily assume that the client has received the response, and commit the database changes?
The reason I am asking this, is that I don't want the server's database to be in a state that believes that the client has got the response, but the client hasn't. This will result in lost of sync between the client devices and the server.

Counterpart of Ajax on server side

I am a beginner in web and server side development and have just read about Ajax. It is used on client side to access any resource over the internet.
But I am thinking of some utility on the server side as ajax so that server is able to send request to the client and client responds to the request.
Do you people know how to achieve this? Basically what I want to achieve is that I have a server which sends the curent server time to the connected client each second.
Thank you!
This can be achieved with websockets.
In .NET we use SignalR to achieve what you need. Server sends a message and client replies to it. This is pubsub scenario.
https://hackernoon.com/create-your-own-pubsub-client-server-use-websocket-65dd1820e997

How can a Netty server cancel receiving a response from a web server?

Does anyone know the best way for a netty server handler to cancel receiving data from a web server? I have a server handler which proxies HttpRequests to a web server. However, when the requesting client cancels the request, I would like to stop receiving data on my server channel from the web server without closing the connection between the server handler and the web server.
Does anyone know how I can go about doing this. Your response would be much appreciated.
Thank you!
You could call channel.config().setAutoRead(false) this will tell netty to stop reading from the Channel. Once you want to start reading again just call channel.config().setAutoRead(false).

Using SignalR to push to clients from a long running process

Firstly, here is state of my application:
I have a request coming in from a client (angularjs app) into my API (web api 2). This request is processed and a record is stored in a database. A response is then sent back to the client.
Currently, I have a windows service polling and processing this record(s).
Processing this record can be long running. As a side effect to processing this record, there might be notifications generated to be sent back to one or more clients.
My question is how do I architect this, such that I can utilise SignalR to be able to push the notifications back to the client.
My stumbling block:
I can register and store (in-memory backed by a db) the client's SignalR connectionid along with the application's own user identifier. This way I can match a generated notification with a signalr client.
At the moment, I'm hosting the SignalR hubs within the IIS process. So how do I get back from the Windows Service to IIS to notify the client when a notification is generated?
Furthermore, I should say I am already using SignalR elsewhere in the application and am using a SQL Server backplane.
The issue's with the current architecture:
Any processing is done in the same web request, and notifications are sent out via SignalR before a response to the client is returned. Luckily, the processing is minimal and very quick.
I think this is not very good in terms of performance or maintenance in the long run.
Potential solutions:
Remove SignalR hubs from IIS and host them somewhere else - windows service?
Expose an endpoint on the API to for the windows service to call to push the notification once a notification is generated?
Finally, to add more ingredients to the mix: Use a service bus to remove the polling component of the windows service, and move to a pub/sub architecture. Although this is more work than I want to chew off right now.
Any ideas/recommendations/constructive criticisms are welcome.
Thanks.
Take a look at this sample for starters
Another more advanced solution can be using a backplane to manage the communications between the front end and the backend...
HTH

how to interact between TCP/IP server and web app in J2EE

I have a Web application based on Spring MVC 3.2 and TCP/IP Server written by Netty. Recently, I have got some requirement. It needs to be sent to the TCP/IP client via the TCP/IP server when a user wants to type some message on the Web browser. Of course, the message should be go to the Web application first and it will pass it to TCP/IP server and get back result. What would be the solution covering this requirement? I am having a look at AtiveMQ and Camel but not clear how to build these kind system.
Please let me get some clue or example.
Thanks.

Resources