wwMethodCallback Chat
Home
|
Reset Page
|
Open another Window
|
Page created: 7/24/2008 8:29:54 PM
Messages:
Enter a Message:
Your Chat Handle:
Enter a Chat Id:
Active Users:
This example demonstrates using the wwMethodCallback control to an HTTP handler that implements the Chat Message service functionality. There's no code in the server page at all - all the code is in the HTTP handler which effectively becomes a service. Using an HTTP Handler is more efficient than calling back to the page and is a great choice if you don't need any logic or control content from the original page.
The majority of the code sits on the client side. This code uses the client proxy to make calls to the server and update the controls on the page.
Since AJAX cannot reliably do a PUSH model the only way for the client to get the latest messages is to poll the server for updates frequently. Therefore this is a very chatty interface that fires a lot of requests to the server. Load with many users in this scenario could very easily become a scalability problem. However, this example uses pure JSON messages which push only updated data back and forth so message size generally is very small. You might want to break out Fiddler and compare both the ATLAS and Anthem chat which use different approaches, where this approach is the more bandwidth friendly of the two.