MRemoteProcedureCall

MRemoteProcedureCall ⇐ MAbstract

Trait implementing RPC logic

Kind: global mixin
Extends: MAbstract
Properties

NameTypeDescription
connectionTimeoutNumber

Timeout delay for RPC connection (default 5OOOms)

nbRetryNumber

Number of connection retry before rejecting connection (default 5)

retryDelayNumber

Delay before connection retry (default Oms)

timerTimerManager
serverAvailablebool

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

ParamTypeDescription
optionsObject

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

ParamTypeDescription
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

ParamTypeDescription
optionsObject

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.

ParamType
dataObject

_createMessage(callArgs, callId) ⇒ *

Extension point to create message to send with its unique id

Kind: instance abstract method of MRemoteProcedureCall
Returns: * - Message to send

ParamTypeDescription
callArgs*

Arguments provided for the call

callIdNumber

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

ParamTypeDescription
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

ParamTypeDescription
callArgs*

Args passed to RPC call

_serialize(data) ⇒ string

Allows to serialise data

Kind: instance method of MRemoteProcedureCall
Returns: string - Serialised result
Access: protected

ParamTypeDescription
data*

Data to serialise

_unserialize(data) ⇒ string

Allows to unserialize data

Kind: instance method of MRemoteProcedureCall
Returns: string - Unserialized result
Access: protected

ParamTypeDescription
data*

Data to unserialize

__connect()

Kind: instance method of MRemoteProcedureCall

parsedResponseResult : Object

Object resulting on parsed received message

Kind: inner typedef of MRemoteProcedureCall
Properties

NameTypeDescription
callIdNumber

Unique id of the pending call

response*

Response to send to pending call promise

isErrorBoolean

True if pending promise should be rejected