Skip to content

Instantly share code, notes, and snippets.

@KnowledgeGarden
Created January 21, 2012 18:13
Show Gist options
  • Save KnowledgeGarden/1653472 to your computer and use it in GitHub Desktop.
Save KnowledgeGarden/1653472 to your computer and use it in GitHub Desktop.
Chat comet response code
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