ethereumjs-client › "net/protocol/protocol" › Protocol
Base class for all wire protocols
memberof
module:net/protocol
-
EventEmitter
↳ Protocol
- addListener
- bind
- decode
- decodeStatus
- emit
- encode
- encodeStatus
- eventNames
- getMaxListeners
- handshake
- listenerCount
- listeners
- off
- on
- once
- open
- prependListener
- prependOnceListener
- rawListeners
- removeAllListeners
- removeListener
- setMaxListeners
- listenerCount
+ new Protocol(options
: ProtocolOptions): Protocol
Overrides void
Defined in lib/net/protocol/protocol.ts:43
Create new protocol
Parameters:
Name | Type |
---|---|
options |
ProtocolOptions |
Returns: Protocol
• config: Config
Defined in lib/net/protocol/protocol.ts:41
• opened: boolean
Defined in lib/net/protocol/protocol.ts:43
• timeout: number
Defined in lib/net/protocol/protocol.ts:42
▪ 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 messages(): Message[]
Defined in lib/net/protocol/protocol.ts:113
Messages defined by this protocol
type
{Protocol~Message[]}
Returns: Message[]
• get name(): string
Defined in lib/net/protocol/protocol.ts:97
Abstract getter for name of protocol
type
{string}
Returns: string
• get versions(): number[]
Defined in lib/net/protocol/protocol.ts:105
Protocol versions supported
type
{number[]}
Returns: number[]
▸ 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
▸ bind(peer
: Peer, sender
: Sender): Promise‹BoundProtocol›
Defined in lib/net/protocol/protocol.ts:171
Binds this protocol to a given peer using the specified sender to handle message communication.
Parameters:
Name | Type | Description |
---|---|---|
peer |
Peer | peer |
sender |
Sender | sender |
Returns: Promise‹BoundProtocol›
▸ decode(message
: Message, payload
: any): any
Defined in lib/net/protocol/protocol.ts:157
Decodes message payload
Parameters:
Name | Type | Description |
---|---|---|
message |
Message | message definition |
payload |
any | message payload |
Returns: any
▸ decodeStatus(_status
: any): any
Defined in lib/net/protocol/protocol.ts:131
Decodes status message payload into a status object. Must be implemented by subclass.
Parameters:
Name | Type |
---|---|
_status |
any |
Returns: any
▸ 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
▸ encode(message
: Message, args
: any): any
Defined in lib/net/protocol/protocol.ts:142
Encodes message into proper format before sending
Parameters:
Name | Type | Description |
---|---|---|
message |
Message | message definition |
args |
any | message arguments |
Returns: any
▸ encodeStatus(): any
Defined in lib/net/protocol/protocol.ts:121
Encodes status into status message payload. Must be implemented by subclass.
Returns: any
▸ 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
▸ handshake(sender
: Sender): Promise‹unknown›
Defined in lib/net/protocol/protocol.ts:71
Perform handshake given a sender from subclass.
Parameters:
Name | Type |
---|---|
sender |
Sender |
Returns: Promise‹unknown›
▸ 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‹boolean | void›
Defined in lib/net/protocol/protocol.ts:62
Opens protocol and any associated dependencies
Returns: Promise‹boolean | void›
▸ 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
▸ 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