Skip to content

Commit

Permalink
Add support for a manual testing server
Browse files Browse the repository at this point in the history
  • Loading branch information
brycekahle committed Sep 21, 2018
1 parent 4027289 commit 1a0f46a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var port = 9889;
var SockFrameworkFactory = function(config, logger) {
var log = logger.create('sockjs.server');
log.info('Starting sockjs test server...');
testServer(port, config);
testServer(port, config, '/sockjs-test');
};

module.exports = function(config) {
Expand Down
6 changes: 6 additions & 0 deletions tests/support/manual.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

require('./sockjs_server')(8081, {
listenAddress: '127.0.0.1',
port: 8081
});
4 changes: 2 additions & 2 deletions tests/support/sockjs_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var url = require('url');
var path = require('path');
var debug = require('debug')('sockjs-client:test-server:main');

function startServer(port, config) {
function startServer(port, config, prefix) {
var clientOptions = {
// Address of a sockjs test server.
url: 'http://' + config.listenAddress + ':' + config.port,
Expand Down Expand Up @@ -61,7 +61,7 @@ function startServer(port, config) {
});

sockjs.install({
sockjs_url: 'http://' + config.listenAddress + ':' + config.port + '/sockjs-test/lib/sockjs.js',
sockjs_url: 'http://' + config.listenAddress + ':' + config.port + (prefix || '') + '/lib/sockjs.js',
websocket: true,
log: function (severity, message) {
debug('[%s] %s', severity, message);
Expand Down

0 comments on commit 1a0f46a

Please sign in to comment.