ethereumjs-client › "service/service" › Service
Base class for all services
memberof
module:service
-
EventEmitter
↳ Service
- addListener
- close
- emit
- eventNames
- getMaxListeners
- handle
- listenerCount
- listeners
- off
- on
- once
- open
- prependListener
- prependOnceListener
- rawListeners
- removeAllListeners
- removeListener
- setMaxListeners
- start
- stop
- listenerCount
+ new Service(options
: ServiceOptions): Service
Overrides void
Defined in lib/service/service.ts:20
Create new service and associated peer pool
Parameters:
Name | Type |
---|---|
options |
ServiceOptions |
Returns: Service
• config: Config
Defined in lib/service/service.ts:17
• opened: boolean
Defined in lib/service/service.ts:18
• pool: PeerPool
Defined in lib/service/service.ts:20
• running: boolean
Defined in lib/service/service.ts:19
▪ defaultMaxListeners: number
Inherited from Sender.defaultMaxListeners
Defined in node_modules/@types/node/events.d.ts:45
▪ errorMonitor: keyof symbol
Inherited from Sender.errorMonitor
Defined in node_modules/@types/node/events.d.ts:55
This symbol shall be used to install a listener for only monitoring 'error'
events. Listeners installed using this symbol are called before the regular
'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
'error'
event is emitted, therefore the process will still crash if no
regular 'error'
listener is installed.
• get name(): any
Defined in lib/service/service.ts:59
Service name
type
{string}
Returns: any
• get protocols(): Protocol[]
Defined in lib/service/service.ts:68
Returns all protocols required by this service
type
{Protocol[]} required protocols
Returns: Protocol[]
▸ addListener(event
: string | symbol, listener
: function): this
Inherited from Sender.addListener
Defined in node_modules/@types/node/events.d.ts:62
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ close(): Promise‹void›
Defined in lib/service/service.ts:96
Close service.
Returns: Promise‹void›
▸ emit(event
: string | symbol, ...args
: any[]): boolean
Defined in node_modules/@types/node/events.d.ts:72
Parameters:
Name | Type |
---|---|
event |
string | symbol |
...args |
any[] |
Returns: boolean
▸ eventNames(): Array‹string | symbol›
Inherited from Sender.eventNames
Defined in node_modules/@types/node/events.d.ts:77
Returns: Array‹string | symbol›
▸ getMaxListeners(): number
Inherited from Sender.getMaxListeners
Defined in node_modules/@types/node/events.d.ts:69
Returns: number
▸ handle(_message
: any, _protocol
: string, _peer
: Peer): Promise‹any›
Defined in lib/service/service.ts:136
Handles incoming request from connected peer
Parameters:
Name | Type |
---|---|
_message |
any |
_protocol |
string |
_peer |
Peer |
Returns: Promise‹any›
▸ listenerCount(event
: string | symbol): number
Inherited from Sender.listenerCount
Defined in node_modules/@types/node/events.d.ts:73
Parameters:
Name | Type |
---|---|
event |
string | symbol |
Returns: number
▸ listeners(event
: string | symbol): Function[]
Inherited from Sender.listeners
Defined in node_modules/@types/node/events.d.ts:70
Parameters:
Name | Type |
---|---|
event |
string | symbol |
Returns: Function[]
▸ off(event
: string | symbol, listener
: function): this
Defined in node_modules/@types/node/events.d.ts:66
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ on(event
: string | symbol, listener
: function): this
Defined in node_modules/@types/node/events.d.ts:63
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ once(event
: string | symbol, listener
: function): this
Defined in node_modules/@types/node/events.d.ts:64
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ open(): Promise‹undefined | false›
Defined in lib/service/service.ts:76
Open service. Must be called before service is running
Returns: Promise‹undefined | false›
▸ prependListener(event
: string | symbol, listener
: function): this
Inherited from Sender.prependListener
Defined in node_modules/@types/node/events.d.ts:75
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ prependOnceListener(event
: string | symbol, listener
: function): this
Inherited from Sender.prependOnceListener
Defined in node_modules/@types/node/events.d.ts:76
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ rawListeners(event
: string | symbol): Function[]
Inherited from Sender.rawListeners
Defined in node_modules/@types/node/events.d.ts:71
Parameters:
Name | Type |
---|---|
event |
string | symbol |
Returns: Function[]
▸ removeAllListeners(event?
: string | symbol): this
Inherited from Sender.removeAllListeners
Defined in node_modules/@types/node/events.d.ts:67
Parameters:
Name | Type |
---|---|
event? |
string | symbol |
Returns: this
▸ removeListener(event
: string | symbol, listener
: function): this
Inherited from Sender.removeListener
Defined in node_modules/@types/node/events.d.ts:65
Parameters:
▪ event: string | symbol
▪ listener: function
▸ (...args
: any[]): void
Parameters:
Name | Type |
---|---|
...args |
any[] |
Returns: this
▸ setMaxListeners(n
: number): this
Inherited from Sender.setMaxListeners
Defined in node_modules/@types/node/events.d.ts:68
Parameters:
Name | Type |
---|---|
n |
number |
Returns: this
▸ start(): Promise‹void | boolean›
Defined in lib/service/service.ts:108
Start service
Returns: Promise‹void | boolean›
▸ stop(): Promise‹void | boolean›
Defined in lib/service/service.ts:121
Stop service
Returns: Promise‹void | boolean›
▸ listenerCount(emitter
: EventEmitter, event
: string | symbol): number
Inherited from Sender.listenerCount
Defined in node_modules/@types/node/events.d.ts:44
deprecated
since v4.0.0
Parameters:
Name | Type |
---|---|
emitter |
EventEmitter |
event |
string | symbol |
Returns: number