【发布时间】:2012-09-15 13:22:29
【问题描述】:
我有以下简单的 Coffeescript 代码来访问 Twitter Stream API
http = require 'http'
options =
port: 443
host: 'stream.twitter.com'
path: '/1.1/statuses/filter.json?track=keyword'
headers:
'Authorization': 'Basic ' + new Buffer('[user]:[pass]').toString 'base64'
'Host': 'stream.twitter.com'
method: 'GET'
callback = (res) ->
console.log res
res.on 'data', (chunk) ->
console.log chunk
res.on 'end', -> console.log 'end'
# res.on 'close', -> res.emit 'end'
http.request options, callback
我为什么会得到
throw arguments[1]; // Unhandled 'error' event
Error: socket hang up
【问题讨论】: