use external http
This commit is contained in:
+6
-3
@@ -10,7 +10,6 @@ export class RPCServer<
|
||||
InterfaceT extends T.RPCInterface = T.RPCInterface,
|
||||
> {
|
||||
|
||||
private ws = http.createServer()
|
||||
private pio = PromiseIO.createServer()
|
||||
private visibility: T.Visibility
|
||||
private closeHandler: T.CloseHandler
|
||||
@@ -28,7 +27,8 @@ export class RPCServer<
|
||||
constructor(
|
||||
private port: number,
|
||||
private exporters: T.ExporterArray<InterfaceT> = [],
|
||||
conf: T.ServerConf<InterfaceT> = {}
|
||||
private conf: T.ServerConf<InterfaceT> = {},
|
||||
private ws = http.createServer()
|
||||
) {
|
||||
if (!conf.visibility) this.visibility = "0.0.0.0"
|
||||
|
||||
@@ -67,6 +67,8 @@ export class RPCServer<
|
||||
\n`+ badRPC.toString() + `
|
||||
\n>------------OFFENDING RPC`)
|
||||
}
|
||||
|
||||
|
||||
this.startWebsocket()
|
||||
}
|
||||
|
||||
@@ -81,7 +83,8 @@ export class RPCServer<
|
||||
this.initRPCs(socket)
|
||||
})
|
||||
|
||||
this.pio.listen(this.port)
|
||||
if(this.conf.selfStart == null || this.conf.selfStart == true)
|
||||
this.pio.listen(this.port)
|
||||
|
||||
} catch (e) {
|
||||
this.errorHandler(this.pio, e, 'system', [])
|
||||
|
||||
@@ -28,6 +28,7 @@ export type ExporterArray<InterfaceT extends RPCInterface = RPCInterface> = I.RP
|
||||
export type ConnectedSocket<T extends RPCInterface = RPCInterface> = RPCSocket & AsyncIfc<T>
|
||||
|
||||
export type ServerConf<InterfaceT extends RPCInterface> = {
|
||||
selfStart?: boolean
|
||||
accessFilter?: AccessFilter<InterfaceT>
|
||||
connectionHandler?: ConnectionHandler
|
||||
errorHandler?: ErrorHandler
|
||||
|
||||
Reference in New Issue
Block a user