Created
January 21, 2012 18:13
-
-
Save KnowledgeGarden/1653472 to your computer and use it in GitHub Desktop.
Chat comet response code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ChatComet extends CometActor with CometListener { | |
//Register as a listener with the ChatCometServer | |
def registerWith = ChatCometServer | |
//No pre render needed | |
def render = <br/> | |
//Proccess messages | |
//called during update from ChatCometServer | |
override def lowPriority = { | |
case fullChatLine: FullChatLine => { | |
Environment.logDebug("ChatComet "+SessionActiveConversation.is+" "+fullChatLine.conversastionId) | |
SessionActiveConversation.is match { | |
case Full(conversationId) if(conversationId.equals(fullChatLine.conversastionId)) => { | |
Environment.logError("FullChatLine didn't screw up") | |
this.partialUpdate(OnLoad((JqJE.Jq("#chat") ~> JqJE.JqAppend(ChatTemplate.getXHTML(fullChatLine))).cmd & | |
JsRaw("$('.time-formatted').each(function (i) {toLocalDate($(this)); $(this).removeClass('time-formatted');});scrollBottom();alert('conversationId');").cmd) | |
) | |
} | |
case Full(conversationId) if(!conversationId.equals(fullChatLine.conversastionId)) => { | |
Environment.logError("FullChatLine screwed up") | |
} | |
case _ => | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment