我有以下简单的 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