logux / server

Build your own Logux server or make a proxy between a WebSocket and an HTTP backend in any language

Home Page:https://logux.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to provide a reporter to the Server

ertrzyiks opened this issue · comments

Hi,

I'm trying to add tests for my server class and to do that I need to pass a reporter mock. It's possible only with BaseServer, but Server class builds reporter on it's own.

class MyServer extends Server {
 ...
}

new MyServer(options, reporterMock) // it doesn't work

The solution could be to inherit from BaseServer and copy-paste the bootstrap code from Server

class MyServer extends BaseServer {
 ...copy paste Server code here
}

new MyServer(options, reporterMock) // it works!

What do you think about adding an option to override reporter in Server class as well? Or maybe compose Server with BaseServer instead of inherit from it?

I like the idea too override reporter in Server, good idea.

Please send PR.