Last Updated: February 25, 2016
·
1.144K
· paulbjensen

Run SocketStream on Heroku

It's possible to run SocketStream applications on Heroku, even though Heroku does not support Websockets. Here's how.

1 - In your application's package.json file, add the ss-engine.io npm as a dependency:

"dependencies": {
  "ss-engine.io":"0.1.0"
}

2 - In your application's app.js file, add the following code:

ss.ws.transport.use(require('ss-engine.io'), {
  client: {
    transports: ["polling"],
    upgrade: false
  },
  server: {
    transports: ["polling"],
    allowUpgrades: false,
    pingInterval: 10000
  }
});

3 - In order to make SocketStream install on Heroku without problems, change the npm dependency version for SocketStream to this:

"socketstream":"git://github.com/socketstream/socketstream.git"

SocketStream has replaced Socket.io with Engine.io. This is currently in the master branch of SocketStream's codebase, and is likely to feature in the coming 0.3.3 release.

To see an example of SocketStream running on Heroku, checkout the default application running here: http://arcane-thicket-3372.herokuapp.com