On a website hosted on IIS 7.5 i make several HTTP Calls to a node.js server running on localhost:3000. So the reverse proxy fordwards from http://example.com/node/* --> localhost:3000/*
Every HTTP call works perfectly except one:
A HTTP Call that uses HTML5 Event Source API (Server-sent events) to sent a message to the client. Do I need to perform additional customizations to allow this type of calls via the IIS reverse proxy?
client:
var source = new EventSource("http://example.com/node/payments?wallet="+btcwalletdir); source.addEventListener('message', function(e) { // do whatever here with e } }, false);
node.js:
app.get('/payments', function(req, res) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "X-Requested-With"); res.connection.setTimeout(0); // this could take a while res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache', }); ee.on("payment"+req.query.wallet, function (datoak) { res.write("data: "+ JSON.stringify({'wallet': datoak.address, 'refund_address': datoak.refund_address,'payment_status': 'paid'})+ "\n\n") }); });
Regards,