Sep 23rd, 2008, 01:29 PM
DWR - Need Help - Reverse AJAX to specified users
I am using DWR to send reverse AJAX messages to users of a web app (Spring, Spring Security, DWR). I have a class that I call from the server when a certain event takes place. This calls a JS function to display a simple browser message box (DWR Reverse AJAX). The problem is it returns to all users. I want to send it to a certain user that is logged in no matter what page they are on. I can get my script sessions for all users on any page but I want to limit the users I get based on the user ID/HTTP Session ID. Is there a way of doing this?
I have thought of one solution but it is messy:
Have the JS built dynamically in the JSP so the method would be votifyUserBob where Bob would be the logged in user. Then when my reverse AJAX call was run it would call the function name with the user name appended. This function then only exists in the one page. This has a severe limitation: I need to send the user id to every page in every model. This also limits me to always sending a model to my view instead of the object the view needs. I really want a better way... any ideas?
Tags for this Thread