Comments (8)
Linux nb-lkoopmann 2.6.35-30-generic #56-Ubuntu SMP Mon Jul 11 20:01:08 UTC 2011 x86_64 GNU/Linux
from cramp.
Could you please try curl with -N option:
curl -N -v http://127.0.0.1:3000
from cramp.
local ~$ curl -N -v http://127.0.0.1:3000
* About to connect() to 127.0.0.1 port 3000 (#0)
* Trying 127.0.0.1... connected
* Connected to 127.0.0.1 (127.0.0.1) port 3000 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: 127.0.0.1:3000
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: text/html
< Connection: keep-alive
< Server: thin 1.2.11 codename Bat-Shit Crazy
* no chunk, no close, no size. Assume close to signal end
<
Hello Worldfoo* Closing connection #0
Thanks!
from cramp.
The Twitter stream API for example is working and streaming for me with the same curl call:
local ~$ curl -v http://stream.twitter.com/1/statuses/sample.json -umyuser:mypass
* About to connect() to stream.twitter.com port 80 (#0)
* Trying 199.59.148.138... connected
* Connected to stream.twitter.com (199.59.148.138) port 80 (#0)
* Server auth using Basic with user '_lennart'
> GET /1/statuses/sample.json HTTP/1.1
> Authorization: [REMOVED]
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: stream.twitter.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: Jetty(6.1.25)
<
{"in_reply_to_screen_name":null,"text":"What's for breakfast tho?","in_reply_to_user_id_str":null,
....
from cramp.
It's likely because Twitter API results would fill the curl buffer very quickly, so you'd see the results almost instantly.
from cramp.
Okay. So you think it is a problem with curl? (Just to make sure: It was still not working with the curl -N switch)
from cramp.
Ah I thought -N did the trick. I'll have a look later today.
Thanks!
from cramp.
I suspect the problem is due to the sleep
call locking up the EM reactor while the 'Hello World' render has been buffered to the output stream, but not yet flushed.
Instead of holding up the whole reactor with sleep
, try EM::add_timer
, like so:
# hello_world.ru
require "rubygems"
require 'cramp'
class HomeAction < Cramp::Action
def start
render "Hello World"
EventMachine::add_timer(5) do
render "foo"
finish
end
end
end
run HomeAction
from cramp.
Related Issues (20)
- No output when using Rack::Deflater
- Tests fail on 1.9.2 and 1.9.3 HOT 2
- ActiveSupport really needed?
- Cramp not flushing on render HOT 1
- Rack::Session:Cookie
- can you integrate cramp into existing rails app? HOT 2
- I've got YARD exceptions, installing cramp
- cramp/callbacks.rb:92:in `handle_exception HOT 1
- http://cramp.in borken
- Fibers and respond_with
- Invalid Multibyte Escape in Ruby 2.0.0 HOT 1
- Can't use Cramp in Gemfile HOT 1
- Support for Rails 4? HOT 1
- cramp websockets not work on Thin since faye-websocket ~> 0.7.1 HOT 2
- Reserved bit error HOT 2
- Have a question about on_start stage HOT 3
- Website down HOT 11
- Does cramp support other ORM? HOT 1
- cramp with twitter feed
- cramp.in is down HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cramp.