2

I have been tinkering with deployd on Heroku using this gist as a starting point:

Line 20 of that server.js tries to set transports for socket.io like so:

server.sockets.manager.settings.transports = ["xhr-polling"];

But encounters this error:

Cannot read property 'settings' of undefined.

From research so far it seems this approach is deprecated in socket.io 1.4.5. However, if that's so I am not clear on how I should address this setting.

My question is similar to this one. But differs in that I seek to change the settings once socket.io is already constructed by and attached to an instance of deployd.

Trevor Reid
  • 3,310
  • 4
  • 27
  • 46

1 Answers1

2

Set it on creation:

var server = deployd({
    socketIo: {
        options: { transports : ['xhr-polling'] }
    }
});

Or if you can't do that, change it runtime (this is a hack):

server.sockets.server.eio.transports = ['xhr-polling'];

(This is still supported for backwards compatibility:)

server.sockets.server.set('transports', ['xhr-polling']);
bolav
  • 6,938
  • 2
  • 18
  • 42
  • The third option, backwards compatibility, worked so I am back in business. I will try your other two suggestions when I have time to come back to it. I'll update this question with the results when I have them. Thanks for your help – Trevor Reid Feb 28 '16 at 00:05