FogletProtocol
FogletProtocol represent an abstract protocol. A Protocol is a a set of behaviours used to interact with others foglet that shares the same protocol.
Constructor Summary
Public Constructor | ||
public |
constructor(name: string, foglet: Foglet, args: ...*) Constructor |
Member Summary
Private Members | ||
private |
_answerQueue: * |
|
private |
_foglet: * |
|
private |
_name: * |
Method Summary
Private Methods | ||
private |
_answerReject(id: string, msg: Object) Handler which reject answers to messages |
|
private |
_answerReply(id: string, msg: Object) Handler which resolve answers to messages |
|
private |
_handleBroadcast(senderID: string, msg: Object): void Handle the reception of a broadcast message |
|
private |
_handleUnicast(senderID: string, msg: Object): void Handle the reception of an unicast message |
|
private |
_initHandlers(): void Initialize the reception of messages from unicast & broadcast channels |
|
private |
_sendBroadcast(msg: *): void Helper to send a broadcast message |
|
private |
_sendUnicast(id: string, msg: *, resolve: function, reject: function): void Helper to send a unicast message |
Public Constructors
Private Methods
private _handleBroadcast(senderID: string, msg: Object): void source
Handle the reception of a broadcast message
Return:
void |
private _handleUnicast(senderID: string, msg: Object): void source
Handle the reception of an unicast message
Return:
void |
private _initHandlers(): void source
Initialize the reception of messages from unicast & broadcast channels
Return:
void |
private _sendBroadcast(msg: *): void source
Helper to send a broadcast message
Params:
Name | Type | Attribute | Description |
msg | * | The message to send |
Return:
void |
private _sendUnicast(id: string, msg: *, resolve: function, reject: function): void source
Helper to send a unicast message
Params:
Name | Type | Attribute | Description |
id | string | ID of the peer to which the message should be sent |
|
msg | * | The message to send |
|
resolve | function | Function used to resolve a related promise when an answer to the message is received |
|
reject | function | Function used to reject a related promise when an answer to the message is received |
Return:
void |