2015-12-03 15:47:20 -08:00
# Tendermint Socket Protocol (TMSP)
2015-11-02 07:39:53 -08:00
2015-12-14 18:06:56 -05:00
**TMSP** is a socket protocol enabling a consensus engine, running in one process,
to manage an application state, running in another.
Thus the applications can be written in any programming language.
2015-12-03 15:47:20 -08:00
TMSP is an asynchronous protocol: message responses are written back asynchronously to the platform.
2015-11-02 07:39:53 -08:00
*Applications must be deterministic.*
2015-12-21 17:41:35 -08:00
For more information on TMSP, motivations, and tutorials, please visit [our blog post ](http://tendermint.com/posts/tendermint-socket-protocol/ ) that explains it all.
2015-11-02 07:39:53 -08:00
## Message types
#### AppendTx
* __Arguments__:
* `TxBytes ([]byte)`
* __Returns__:
* `RetCode (int8)`
* __Usage__:< br />
Append and run a transaction. The transaction may or may not be final.
#### GetHash
* __Returns__:
* `RetCode (int8)`
* `Hash ([]byte)`
* __Usage__:< br />
Return a Merkle root hash of the application state
#### Commit
* __Returns__:
* `RetCode (int8)`
* __Usage__:< br />
Finalize all appended transactions
#### Rollback
* __Returns__:
* `RetCode (int8)`
* __Usage__:< br />
Roll back to the last commit
#### AddListener
* __Arguments__:
* `EventKey (string)`
* __Returns__:
* `RetCode (int8)`
* __Usage__:< br />
Add event listener callback for events with given key.
#### RemoveListener
* __Arguments__:
* `EventKey (string)`
* __Returns__:
* `RetCode (int8)`
* __Usage__:< br />
Remove event listener callback for events with given key.
2015-11-16 15:50:26 -08:00
#### Flush
* __Usage__:< br />
Flush the response queue. Applications that implement `types.Application` need not implement this message -- it's handled by the project.
#### Info
* __Returns__:
* `Data ([]string)`
* __Usage__:< br />
Return an array of strings about the application state. Application specific.
2015-11-27 10:14:46 -08:00
#### SetOption
* __Arguments__:
* `Key (string)`
* `Value (string)`
* __Returns__:
* `RetCode (int8)`
* __Usage__:< br />
Set application options. E.g. Key="mode", Value="mempool" for a mempool connection, or Key="mode", Value="consensus" for a consensus connection.
Other options are application specific.