I have a web application which is making a socket connection with a NodeJS server hosted via IIS Node. The connection seems to be made properly as I resolved a 404 polling error on the client that I was initially having. However now, it looks like the client is not receiving socket events from IIS Node.
My theory is that because IIS Node is acting like a proxy, the event sent back to the client is stopping somewhere at the IIS Node level.
exports.register = function(socket) {
User.schema.post('save', function (doc) {
console.log("Save socket");
onSave(socket, doc);
});
}
function onSave(socket, doc, cb) {
socket.emit('User List Update', doc);
}
In Node, the above event fires, but it is not received on the front end.
The client looks like this:
var socket = io.connect("http://myinternallyhostedserver:7777/reception");
socket.on('User List Update', function () {
console.log('Received socket event!');
if (vm.enableAlert) {
vm.alertSound.play();
}
vm.getUsers();
});
My web.config file looks like this:
<configuration>
<appSettings>
<add key="virtualDirPath" value="/reception" />
</appSettings>
<system.webServer>
<handlers>
<add name="iisnode" path="server/app.js" verb="*" modules="iisnode" />
</handlers>
<iisnode enableXFF="true" />
<webSocket enabled="false"/>
<rewrite>
<rules>
<rule name="reception">
<match url="/*" />
<action type="Rewrite" url="server/app.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Running all of this on my local machine works properly. Socket events are sent and received. Adding IIS Node into the workflow seems to be where it stopped working. Any help would be greatly appreciated.