RSS
热门关键字:  java  Ajax  JSP  JSF  Struts
当前位置 : 首页>Ruby>列表

Ruby on Rails + AJAX + Mongrel + JMS/MQ/MOM = 即时通讯

来源: 作者: 时间:2007-09-19 点击:
      process_post(request, response, query)   
  •     else   
  •       process_get(request, response, query)   
  •     end   
  •   end   
  •      
  •   # Handle POST, use to send message   
  •   # Not implemented   
  •   # TODO: Implement it when needed   
  •   def process_post(request, response, query)   
  •     logger.debug "post method not supported"   
  •     write_response(response, "<message type='WARN' value='Method not supported'/>")   
  •   end   
  •      
  •   # Handle GET, use to receive message   
  •   def process_get(request, response, query)   
  •     begin   
  •       logger.debug "connecting stomp"   
  •       conn = Stomp::Connection.new '', '', 'localhost', 61613, false    
  •       conn.subscribe DEST, { :ack =>"auto" }   
  •     rescue   
  •       logger.error "Error connecting server... #{$!}\n"   
  •       write_response(response,  "<message type='ERROR' value=#{Mongrel::HttpRequest.escape($!)}/>")   
  •       return   
  •     end   
  •        
  •     begin   
  •       msg = ""  
  •       timeout

  • 最新评论共有 0 位网友发表了评论
    发表评论
    评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
    用户名: 密码:
    匿名?
    注册
    Google Adsense
    相关文章