I was asked to test a meteor (js) website in a server without websockets support, how can I achieve this? How can I really know that a server is not capable of using websockets?

up vote 1 down vote accepted

You can achieve that by using environment variables. Remember to always do this on server, either by using /server/lib or /lib/server folder or Meteor.isServer flag. This will do the trick:

Meteor.startup(function () {
  process.env.DISABLE_WEBSOCKETS = 1;
});

You can read more about using environment variables with Meteor on Meteorpedia.

For those interested, when websockets are disabled, Meteor uses sockjs which is a websockets emulator library.

More info here:

https://github.com/sockjs/sockjs-node

http://www.meteorpedia.com/read/Websockets

This project might help folks who get here: https://github.com/cult-of-coders/fusion

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.