MRemoteProcedureCall
On this page
- MRemoteProcedureCall ⇐
MAbstract
- init(options) ⇒
Promise
- onDisconnect()
- unserialize(data) ⇒
string
- _connectService(options) ⇒
Promise.<boolean, Error>
- _disconnectService() ⇒
Promise.<boolean, Error>
- _emitToService(data) ⇒
Promise.<boolean, Error>
- _createMessage(callArgs, callId) ⇒
*
- _parseResponse(response) ⇒
parsedResponseResult
- _handShake() ⇒
Promise.<boolean, Error>
- call(callArgs) ⇒
Promise
- _serialize(data) ⇒
string
- _unserialize(data) ⇒
string
- __connect()
- parsedResponseResult :
Object
- init(options) ⇒
MRemoteProcedureCall ⇐ MAbstract
Trait implementing RPC logic
Kind: global mixin
Extends: MAbstract
Properties
Name | Type | Description |
---|---|---|
connectionTimeout | Number | Timeout delay for RPC connection (default 5OOOms) |
nbRetry | Number | Number of connection retry before rejecting connection (default 5) |
retryDelay | Number | Delay before connection retry (default Oms) |
timer | TimerManager | |
serverAvailable | bool |
- MRemoteProcedureCall ⇐
MAbstract
- instance
- .init(options) ⇒
Promise
- .onDisconnect()
- .unserialize(data) ⇒
string
- ._connectService(options) ⇒
Promise.<boolean, Error>
- ._disconnectService() ⇒
Promise.<boolean, Error>
- ._emitToService(data) ⇒
Promise.<boolean, Error>
- ._createMessage(callArgs, callId) ⇒
*
- ._parseResponse(response) ⇒
parsedResponseResult
- ._handShake() ⇒
Promise.<boolean, Error>
- .call(callArgs) ⇒
Promise
- ._serialize(data) ⇒
string
- ._unserialize(data) ⇒
string
- .__connect()
- .init(options) ⇒
- inner
- ~parsedResponseResult :
Object
- ~parsedResponseResult :
- instance
init(options) ⇒ Promise
Init connection with retry logic
Kind: instance method of MRemoteProcedureCall
Returns: Promise
- Promise resolved when connection to server is done and session established
Param | Type | Description |
---|---|---|
options | Object | Options to pass to init |
onDisconnect()
Extension point from AbstractSocketService
Kind: instance method of MRemoteProcedureCall
unserialize(data) ⇒ string
Allows to unserialize data
Kind: instance method of MRemoteProcedureCall
Returns: string
- Unserialized result
This function can be override
Access: public
Param | Type | Description |
---|---|---|
data | * | Data to unserialize |
_connectService(options) ⇒ Promise.<boolean, Error>
Extension point of the connect method
Kind: instance abstract method of MRemoteProcedureCall
Returns: Promise.<boolean, Error>
- A Promise resolved in case of success rejected otherwise with the reason of the failure
Param | Type | Description |
---|---|---|
options | Object | options to pass to connect method |
_disconnectService() ⇒ Promise.<boolean, Error>
Extension point of the disconnect method
Kind: instance abstract method of MRemoteProcedureCall
Returns: Promise.<boolean, Error>
- A Promise resolved in case of success rejected otherwise with the reason of the failure
_emitToService(data) ⇒ Promise.<boolean, Error>
Extension point of the emit method
Kind: instance abstract method of MRemoteProcedureCall
Returns: Promise.<boolean, Error>
- A Promise resolved in case of success, otherwise rejected with the reason of the failure.
Param | Type |
---|---|
data | Object |
_createMessage(callArgs, callId) ⇒ *
Extension point to create message to send with its unique id
Kind: instance abstract method of MRemoteProcedureCall
Returns: *
- Message to send
Param | Type | Description |
---|---|---|
callArgs | * | Arguments provided for the call |
callId | Number | Unique id of the call |
_parseResponse(response) ⇒ parsedResponseResult
Extension point to parse response
Kind: instance abstract method of MRemoteProcedureCall
Returns: parsedResponseResult
- Parsed response object, null no response needed
Param | Type | Description |
---|---|---|
response | * | Response received to parse |
_handShake() ⇒ Promise.<boolean, Error>
Extension point to be recognised by RPC server
Kind: instance abstract method of MRemoteProcedureCall
Returns: Promise.<boolean, Error>
- A Promise resolved in case of success rejected otherwise with the reason of the failure
call(callArgs) ⇒ Promise
Make a RPC call
Kind: instance method of MRemoteProcedureCall
Param | Type | Description |
---|---|---|
callArgs | * | Args passed to RPC call |
_serialize(data) ⇒ string
Allows to serialise data
Kind: instance method of MRemoteProcedureCall
Returns: string
- Serialised result
Access: protected
Param | Type | Description |
---|---|---|
data | * | Data to serialise |
_unserialize(data) ⇒ string
Allows to unserialize data
Kind: instance method of MRemoteProcedureCall
Returns: string
- Unserialized result
Access: protected
Param | Type | Description |
---|---|---|
data | * | Data to unserialize |
__connect()
Kind: instance method of MRemoteProcedureCall
parsedResponseResult : Object
Object resulting on parsed received message
Kind: inner typedef of MRemoteProcedureCall
Properties
Name | Type | Description |
---|---|---|
callId | Number | Unique id of the pending call |
response | * | Response to send to pending call promise |
isError | Boolean | True if pending promise should be rejected |