Click or drag to resize

Real Time Web Applications

From Wikipedia:

The real-time web is a network web using technologies and practices that enable users to receive information as soon as it is published by its authors, rather than requiring that they or their software check a source periodically for updates.

Fundamentals of Real Time Web Applications

In our view, a Real Time Web Application has to be able to update the user's browser (the client) at any time and seamlessly, as if the browser was a monitor directly connected to the server where the application is running, and at the same time receive events and updates from the client without any delay.

Web based video games are perfect examples of Real Time Web. We have extended the concept to Line of Business Applications.

WebSocket or Polling

When the server supports WebSocket connections, the real time updates from Wisej are "pushed" to client at any time. A background task can update the connected client asynchronously by calling Application.Update().

Some server or some browsers may not support WebSocket connections and can only use HTTP requests. In that case the server cannot possibly contact the browser because each HTTP request is started and terminated every time the browser contacts the server. One solution is to create a Wisej.Web.Timer to periodically fire server events and allow Wisej to update the client.

SignalR emulates a WebSocket connection by using the "long polling" technique, which is to always keep a pending request open to let the server send back an "unattended" response and then open a new suspended request. However, every request blocks a thread, it's prone to timeout errors, and browsers limit the number of open AJAX requests to 4-8 risking to block a request.

If a WebSocket connection is not possible, you can use automatic polling with Wisej. You can call Application.StartPolling() and Application.EndPolling() when you want Wisej to periodically send poll requests to the server. Both methods are ignored when the client is using a WebSocket connection. You can also setup the pollingInterval in the configuration file to let clients always start the polling when WebSocket is not available.

Note Note

Wisej sends all the updates that have occurred since the last request back to the client every time it processes a request. If you have a background task without a WebSocket connection, the browser will get updated everything there is an event: a timer event, a click,...

Main Real Time Features in Wisej

Feature

Description

Push updates.

Wisej applications can update the client at any time during a request or asynchronously from a background task (thread).

Modal workflow.

Business logic, or UI logic, or UI code, running on the server, in a Wisej application, can display a modal dialog, or a modal message box, on the client and suspend execution until the user closes the modal dialog.

Complete session state.

The entire state of the application is always in sync between the client and server. You can hit refresh at any time and the full state is reloaded in the browser, including modal dialogs or message boxes.

Live events.

The server code in a Wisej application can even respond to pointer events such as moving the mouse, moving the wheel, entering or leaving controls, in real time.

Remote methods.

Wisej server side code can call JavaScript code on the user's browser, and client side JavaScript can call server side code on the server - at any time.

Drawing and painting.

Wisej controls can draw or paint on the user's browser. Using the real time features listed above, Wisej can use the HTML5 <canvas> element to create any type of control from server code!. See the ProgressCircle extension. Complex images (non vectorial) can also be painted from the server: See the CustomPainting example.

See Also