Members
(private) _message :string
Message to be included in the response. User this.message() to get/set.
- string
 
- Source:
 
(private) _status :number
HTTP-equivalent status code for this transaction. Use this.status() to get/set.
- number
 
- Source:
 
cm :module:flitter-socket/ConnectionManager~ConnectionManager
The connection manager that spawned this transaction.
- Source:
 
connection_id :string
Unique ID of the websocket client's connection in the connection manager.
- string
 
- Source:
 
id :string
Universally-unique id of this transaction. Used by both parties to match up requests and responses.
- string
 
- Source:
 
incoming :Object
Contains the incoming data for the transaction. That is, the data from the sender.
- Object
 
- Source:
 
outgoing :Object
Contains the outgoing data for the transaction. That is, the data sent/to be sent back to the sender.
- Object
 
- Source:
 
received :boolean
Set to true if 1. the transaction was awaiting data and 2. the data has been received
- boolean
 
- Source:
 
resolved :boolean
Whether the transaction has completed. That is, has the recipient sent a response.
- boolean
 
- Source:
 
sent :boolean
Set to true if 1. this transaction is a response and 2. the response has been sent
- boolean
 
- Source:
 
socket :Socket
The open websocket used for communication
- Socket
 
- Source:
 
type :"request"|"response"
Is this a request or a response-type transaction?
- "request" | "response"
 
- Source:
 
Methods
message(msgopt) → {Transaction|string}
Get or set the message. If a new message is provided, set the message and return this for chaining. Otherwise get the current message.
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
msg | 
            
            string | 
                
                    <optional> | 
            
            
                null | 
- Source:
 
- if message is provided, set the message and return this; otherwise return the current message
 
- Type
 - Transaction | string
 
resolve()
Mark the transaction as resolved.
- Source:
 
send(data) → {*|boolean|void}
Send data to the recipient of this transaction as stringified JSON, and resolve the transaction.
| Name | Type | Description | 
|---|---|---|
data | 
            
            
- Source:
 
- Type
 - * | boolean | void
 
status(codeopt) → {Transaction|number}
Get or set the status code. If a new code is provided, set the status code and return this for chaining. Otherwise, get the current status code.
| Name | Type | Attributes | Default | Description | 
|---|---|---|---|---|
code | 
            
            number | 
                
                    <optional> | 
            
            
                null | 
- Source:
 
- if code is provided, set the code and return this; otherwise return the current code
 
- Type
 - Transaction | number