Jeanfrancois Arcand wrote:
>
>
> Rich Manalang wrote:
>> Cool.thx. I noticed that the demo uses http streaming through an
>> iframe. Is it possible to use long-polling with JRuby?
>
> Yes, just use normal Javascript intead of an iFrame, or stick with an
> iFrame and just add the following line inside the onStateChange method:
The line is:
resourceEvent.getResource().resume();
which will resume the response, hence long-polling.
A+
-- Jeanfrancois
>
>
>> def onStateChange(resourceEvent)
>> writer = resourceEvent.getResource().getResponse().getWriter()
>> writer.write(resourceEvent.getMessage().to_s.ljust(1*1024))
>> writer.flush();
>>
>> resourceEvent.getResource().resume();
>> end
>
> A+
>
> -- Jeanfrancois
>
>
>>
>> Rich
>>
>> On Thu, Oct 29, 2009 at 6:04 PM, Jeanfrancois Arcand
>> <
[hidden email] <mailto:
[hidden email]>> wrote:
>>
>> Salut,
>>
>>
>> Rich Manalang wrote:
>>
>> Hi all. I'm trying out the JRuby demo
>>
>> (
http://weblogs.java.net/blog/jfarcand/archive/2009/09/10/writing-comet-applications-using-jruby-and-atmosphere-framework
>>
>> and
http://gist.github.com/221856). The source code provided on
>> the atmosphere site is missing the index.html file -- anyone
>> know where I can find that?
>>
>>
>> Oh my bad. The sample was using Atmosphere 0.3.1 API
>>
>>
>>
>> Anyway, regardless, I tried to boot it up and go this error:
>>
>> [~/lib/jetty/webapps] jruby chat.rb
>> Oct 29, 2009 1:22:47 PM
>> org.atmosphere.grizzly.AtmosphereSpadeServer start
>> INFO: AtmosphereSpade Server Started on port: 8080
>> Oct 29, 2009 1:22:47 PM com.sun.grizzly.Controller start
>> INFO: Starting Grizzly Framework 1.9.18 - Thu Oct 29 13:22:47
>> PDT 2009
>> Oct 29, 2009 1:22:56 PM org.atmosphere.cpr.AtmosphereServlet init
>> INFO: Atmosphere Framework 0.5-SNAPSHOT started.
>> Oct 29, 2009 1:22:56 PM
>> com.sun.grizzly.http.servlet.ServletAdapter doService
>> SEVERE: service exception:
>> :1: undefined method `onRequest' for #<ChatPage:0x10e9df
>> @java_object=#<Java::JavaObject:0x39edd9b3>> (NoMethodError)
>> ...internal jruby stack elided...
>> from (unknown).(unknown)(:1)
>>
>> I'm using JRuby 1.3.1. Anyone know what the issue is?
>>
>>
>>
>> I'm attaching the sample tested with:
>>
>> jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 6586) (Java HotSpot(TM)
>> Server VM 1.6.0_13) [i386-java]
>>
>> Apology that! Forgot to update that sample.
>>
>> A+
>>
>> -- Jeanfrancois
>>
>>
>>
>>
>> Thanks!
>>
>> Rich
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
[hidden email]
>> <mailto:
[hidden email]>
>> For additional commands, e-mail:
[hidden email]
>> <mailto:
[hidden email]>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
[hidden email]
> For additional commands, e-mail:
[hidden email]
>
---------------------------------------------------------------------
To unsubscribe, e-mail:
[hidden email]
For additional commands, e-mail:
[hidden email]