Understanding the RethinkDB protocol
RethinkDB provides steps for developers who are willing to write client drivers for it in any programming language. These steps are combined to form a small protocol. In this section, we are going to learn this protocol.
The protocol consists of following steps:
Open a connection to RethinkDB.
Perform a handshake.
Query serialization.
Send a message.
Get a response.
Like every other protocol, RethinkDB also uses Transmission control protocol (TCP) to perform the steps mentioned previously.
In order to connect to a RethinkDB instance, open a TCP connection to the RethinkDB Server; by default, the port is 28015.
Before the client driver can perform the query, it needs to perform authentication with the Server in three specific calls one after another; this process is also called handshake. Once this handshake operation is completed, the client driver can execute a query on the RethinkDB Server.
The handshake operation, in a nutshell, works as shown in the following...