We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17e9db2 commit 9173feaCopy full SHA for 9173fea
1 file changed
index.js
@@ -29,9 +29,15 @@ exports.createQuery = Connection.createQuery;
29
30
exports.Pool = Pool;
31
32
-exports.createServer = function(handler) {
+exports.createServer = function(opts = {}) {
33
+ let handler;
34
+ if (typeof opts === 'function') {
35
+ handler = opts;
36
+ } else {
37
+ handler = opts.onConnection;
38
+ }
39
const Server = require('./lib/server.js');
- const s = new Server();
40
+ const s = new Server({ handleCommand: opts.handleCommand, encoding: opts.encoding || 'cesu8' });
41
if (handler) {
42
s.on('connection', handler);
43
}
0 commit comments