node-pusher
node-pusher copied to clipboard
http.createClient is deprecated in node.js v0.8+
When http.createClient is deprecated in node.js v0.8+, the revised source code of node-puser.js is as follows. Please check it out.
Original:
var client = http.createClient(80, this.domain);
var request = client.request('POST', path, {
'host': this.domain,
'content-type': 'application/json',
'content-length': new Buffer(requestBody).toString('binary').length
});
Revised: var _options = { host: this.domain, port: 80, path: path, method: 'POST', 'content-type': 'application/json', 'content-length': new Buffer(requestBody).toString('binary').length } var request = http.request(_options, function(res) {});