Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ module.exports = function(serverConfig, sharedConfig, clientStreamHandler){
server = createWebSocketServer(clientStreamHandler);
} else if(config.protocol == 'wss') {
server = createSecureWebSocketServer(config.ssl, clientStreamHandler);
} else {
throw new Error('negative attach and unknow protocol');
}

server._css_host = config.host;
Expand Down
20 changes: 20 additions & 0 deletions tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,24 @@ describe('create-stream-server', function(){
});
});
});

it('should throw error if negative attach and unknow protocol', function(done) {
try {
var servers = css({
s1: {
attach: null,
protocol: 'unknow-protocol',
host: 'localhost',
port: 9010
}
}, function() {});
} catch(err) {
assert.deepStrictEqual(
err,
new Error('negative attach and unknow protocol'),
'negative attach and unknow protocol should error'
);
done();
}
})
});