module.exports = {
  server: function(primus, options) {
    primus.on('connection', function(spark) {
      spark.hostname = spark.request.headers.host.split(':')[0];
    });
  }
};

module.exports = {
  server: function(primus, options) {
    var url = require('url');
    primus.on('connection', function(spark) {
      spark.hostname = url.parse(
        spark.request.headers.origin ||
        spark.request.headers.host
      ).hostname;
    });
  }
};

Fix domain detection in ws request
Fix domain detection in ws request
