Linguistic forms

Source code for comet project

September 5, 2009 · 1 Comment

This post contains the source code for the comet project (url: http://retkomma.wordpress.com/2009/08/05/server-to-client-notification-using-asp-net-and-comet-approach/).

The download link is at the bottom of this post. The code structure is described first.

How to run the test project

Open in Visual Studio and hit F5 to open Default.aspx page. Now the entries in the xml file notifications.xml will be displayed in the browser. Has been tested with IE only, but will probably work with other browsers as well.

Solution design

The figure below presents a brief overview of the solution design. The solution has been implemented sparsely, but with some limits. The code is not compiled and can thus be reviewed if the project library is downloaded.

comet1

 

 

 

 

 

 

 

The code contains the logical mappings:

Name in the figure above Code mapping
Client Default.aspx
NotificationChecker.ashx Endpoint: NotificationChecker.ashx

Backend: AsyncTaskHandler.cs

Processing from MessageBroker occurs using AsyncResult.cs class.

MessageBroker MessageBroker.cs
Message Queue MessageBrokerRepository.cs
Message Queue Database Not implemented, stub created in notifications.xml
UserHandle AsyncRequestResult.cs
Business Module N Not implemented, can be simulated by using the stub in notifications.xml
NotificationAcknowledge.ashx Not implemented

The figure is shortly described here:

1 to 3: Client submits user handle

1. The client sends a user handle to notificationchecker.ashx.

2. NotificationChecker.ashx sends the handle to the messagebroker.

3. The message broker registers the user handle.

A to C: A business module N submits a notification message to user U

A. Some module submits a notification message to the message broker.

B. The message broker queues the message.

C. The message broker processes the message queue.

D to E: The message broker processes the message queue

D. The message broker checks if the user has submitted a handle. If she has, the user handle is released.

E. The message broker releases the response to the client

F to H: The client acknowledges the notification response

F. Client sends notification acknowledgement to NotificationAcknowledger.ashx.

G. NotificationAcknowledger sends acknowledgement to MessageBroker which finally removes message from repository.

H. The Message Broker sends a 200 (OK) response back to the client

 

Download the code from: http://www.m-8.dk/downloads/testcomet.zip

Categories: Uncategorized

1 response so far ↓

Leave a Comment