Frontend API
export class FBPMessage
This class implements the format of a FBPMessage as described here : https://flowbased.github.io/fbp-protocol/#message-structure
Created by antoine on 15/06/2017.
getProtocol (): string
Returns the protocol field of the message.
- Returns:
string
— the protocol’s name
getCommand (): string
Returns the command field of the message.
- Returns:
string
— the command’s name
getPayloadAsJSON (): Object
Returns the payload field of the message.
- Returns:
Object
— the payload
getPayloadAsString (): string
Returns the payload field of the message, as a serialized string
- Returns:
string
— the protocol’s name
setProtocol(protocol: string)
Set the protocol field of the message.
- Parameters:
protocol
— the new protocol
setCommand(command: string)
Set the command field of the message
- Parameters:
command
— the command to use
setPayload (payload: string)
Set the payload of the message, from a stringified json.
- Parameters:
payload
— the stringified payload
setPayloadFromJson (payload: Object)
Set the payload of the message, from a Javascript object.
- Parameters:
payload
— the new payload
toJSONstring (): string
Stringify the message in order to send it.
- Returns:
string
— the stringified message