21.5. Examples

This section contains concrete examples showing how to perform tasks using the full Bolt protocol stack.

Running a Cypher query

This illustrates running a simple Cypher query without parameters, and retrieving the results.

Run query 

# Handshake
Client: <connect>
Client: 60 60 B0 17
Client: 00 00 00 01  00 00 00 00  00 00 00 00  00 00 00 00
Server: 00 00 00 01

Client: INIT "MyClient/1.0" { "scheme": "basic", "principal": "neo4j", "credentials": "secret"}

  00 40 B1 01  8C 4D 79 43  6C 69 65 6E  74 2F 31 2E
  30 A3 86 73  63 68 65 6D  65 85 62 61  73 69 63 89
  70 72 69 6E  63 69 70 61  6C 85 6E 65  6F 34 6A 8B
  63 72 65 64  65 6E 74 69  61 6C 73 86  73 65 63 72
  65 74 00 00

Server: SUCCESS {}

  00 03 b1 70  a0 00 00

Client: RUN "RETURN 1 AS num" {}

  00 13 b2 10  8f 52 45 54  55 52 4e 20  31 20 41 53
  20 6e 75 6d  a0 00 00

Server: SUCCESS { "fields": ["num"] }

  00 0f b1 70  a1 86 66 69  65 6c 64 73  91 83 6e 75
  6d 00 00

Client: PULL_ALL

  00 02 B0 3F  00 00

Server: RECORD [1]

  00 04 b1 71  91 01 00 00

Server: SUCCESS { "type": "r" }

  00 0A B1 70  A1 84 74 79  70 65 81 72  00 00

Pipelining

This illustrates running two statements and retrieving their results, without waiting for the server to respond in-between.

Note that these two statements are executed in two individual transactions, implicitly created for each statement.

Pipelining 

# Handshake
Client: <connect>
Client: 60 60 B0 17
Client: 00 00 00 01  00 00 00 00  00 00 00 00  00 00 00 00
Server: 00 00 00 01

Client: INIT "MyClient/1.0" { "scheme": "basic", "principal": "neo4j", "credentials": "secret"}

  00 40 B1 01  8C 4D 79 43  6C 69 65 6E  74 2F 31 2E
  30 A3 86 73  63 68 65 6D  65 85 62 61  73 69 63 89
  70 72 69 6E  63 69 70 61  6C 85 6E 65  6F 34 6A 8B
  63 72 65 64  65 6E 74 69  61 6C 73 86  73 65 63 72
  65 74 00 00

Server: SUCCESS {}

  00 03 b1 70  a0 00 00

# Batch of messages
Client: RUN "RETURN 1 AS num" {}

  00 13 b2 10  8f 52 45 54  55 52 4e 20  31 20 41 53
  20 6e 75 6d  a0 00 00

Client: PULL_ALL

  00 02 B0 3F  00 00

Client: RUN "RETURN 1 AS num" {}

  00 13 b2 10  8f 52 45 54  55 52 4e 20  31 20 41 53
  20 6e 75 6d  a0 00 00

Client: PULL_ALL

  00 02 B0 3F  00 00

# Server responses
Server: SUCCESS { "fields": ["num"] }

  00 0f b1 70  a1 86 66 69  65 6c 64 73  91 83 6e 75
  6d 00 00

Server: RECORD [1]

  00 04 b1 71  91 01 00 00

Server: SUCCESS { "type": "r" }

  00 0A B1 70  A1 84 74 79  70 65 81 72  00 00

Server: SUCCESS { "fields": ["num"] }

  00 0f b1 70  a1 86 66 69  65 6c 64 73  91 83 6e 75
  6d 00 00

Server: RECORD [1]

  00 04 b1 71  91 01 00 00

Server: SUCCESS { "type": "r" }

  00 0A B1 70  A1 84 74 79  70 65 81 72  00 00

Error handling with RESET

This illustrates how the server behaves when a request fails, and shows how the server ignores incoming messages until a RESET message is received.

Error handling with RESET 

# Handshake
Client: <connect>
Client: 60 60 B0 17
Client: 00 00 00 01  00 00 00 00  00 00 00 00  00 00 00 00
Server: 00 00 00 01

Client: INIT "MyClient/1.0" { "scheme": "basic", "principal": "neo4j", "credentials": "secret"}

  00 40 B1 01  8C 4D 79 43  6C 69 65 6E  74 2F 31 2E
  30 A3 86 73  63 68 65 6D  65 85 62 61  73 69 63 89
  70 72 69 6E  63 69 70 61  6C 85 6E 65  6F 34 6A 8B
  63 72 65 64  65 6E 74 69  61 6C 73 86  73 65 63 72
  65 74 00 00

Server: SUCCESS {}

  00 03 b1 70  a0 00 00

# Message with syntax error
Client: RUN "This will cause a syntax error" {}

  00 23 b2 10  d0 1e 54 68  69 73 20 77  69 6c 6c 20
  63 61 75 73  65 20 61 20  73 79 6e 74  61 78 20 65
  72 72 6f 72  a0 00 00


# Server responds with failure
Server: FAILURE { "code": "Neo.ClientError.Statement.SyntaxError",
                  "message": "Invalid input 'T': expected <init> (line 1, column 1 (offset: 0))
                          "This will cause a syntax error"
                           ^"}

  00 9E B1 7F  A2 84 63 6F  64 65 D0 25  4E 65 6F 2E
  43 6C 69 65  6E 74 45 72  72 6F 72 2E  53 74 61 74
  65 6D 65 6E  74 2E 53 79  6E 74 61 78  45 72 72 6F
  72 87 6D 65  73 73 61 67  65 D0 65 49  6E 76 61 6C
  69 64 20 69  6E 70 75 74  20 27 54 27  3A 20 65 78
  70 65 63 74  65 64 20 3C  69 6E 69 74  3E 20 28 6C
  69 6E 65 20  31 2C 20 63  6F 6C 75 6D  6E 20 31 20
  28 6F 66 66  73 65 74 3A  20 30 29 29  0A 22 54 68
  69 73 20 77  69 6C 6C 20  63 61 75 73  65 20 61 20
  73 79 6E 74  61 78 20 65  72 72 6F 72  22 0A 20 5E
  00 00

# Further requests are ignored
Client: PULL_ALL

  00 02 b0 3f 00 00

Server: IGNORED

  00 02 b0 7e 00 00


# Until the error is acknowledged
Client: RESET

  00 02 b0 0f 00 00

Server: SUCCESS {}

  00 03 b1 70  a0 00 00


# Server is now ready for new statements
Client: RUN "RETURN 1 AS num" {}

  00 13 b2 10  8f 52 45 54  55 52 4e 20  31 20 41 53
  20 6e 75 6d  a0 00 00

Server: SUCCESS { "fields": ["num"] }

  00 0f b1 70  a1 86 66 69  65 6c 64 73  91 83 6e 75
  6d 00 00

Error handling with ACK_FAILURE

This illustrates how to handle errors with ACK_FAILURE. ACK_FAILURE will not roll back transactions or interrupt messages ahead in line. Instead, it only clears the error state and moves the session either to IDLE or to IN_TRANSCATION.

This is helpful, because it means you always have to run "ROLLBACK" to roll back an open transaction. For some use cases, that helps minimize complexity, because it cuts down the number of error recovery paths.

Error handling with ACK_FAILURE 

# Handshake
Client: <connect>
Client: 60 60 B0 17
Client: 00 00 00 01  00 00 00 00  00 00 00 00  00 00 00 00
Server: 00 00 00 01

Client: INIT "MyClient/1.0" { "scheme": "basic", "principal": "neo4j", "credentials": "secret"}

  00 40 B1 01  8C 4D 79 43  6C 69 65 6E  74 2F 31 2E
  30 A3 86 73  63 68 65 6D  65 85 62 61  73 69 63 89
  70 72 69 6E  63 69 70 61  6C 85 6E 65  6F 34 6A 8B
  63 72 65 64  65 6E 74 69  61 6C 73 86  73 65 63 72
  65 74 00 00

Server: SUCCESS {}

  00 03 b1 70  a0 00 00


# We explicitly create a transaction
Client: RUN "BEGIN" {}

  00 09 B2 10  85 42 45 47  49 4E A0 00  00

Client: PULL_ALL

  00 02 B0 3F  00 00

Server: SUCCESS { "fields": [] }

  00 0B B1 70  A1 86 66 69  65 6C 64 73  90 00 00

Server: SUCCESS {}

  00 03 B1 70  A0 00 00


# And then send a message with a syntax error
Client: RUN "This will cause a syntax error" {}

  00 23 b2 10  d0 1e 54 68  69 73 20 77  69 6c 6c 20
  63 61 75 73  65 20 61 20  73 79 6e 74  61 78 20 65
  72 72 6f 72  a0 00 00


# Server responds with failure
Server: FAILURE { "code": "Neo.ClientError.Statement.SyntaxError",
                  "message": "Invalid input 'T': expected <init> (line 1, column 1 (offset: 0))
                          "This will cause a syntax error"
                           ^"}

  00 9E B1 7F  A2 84 63 6F  64 65 D0 25  4E 65 6F 2E
  43 6C 69 65  6E 74 45 72  72 6F 72 2E  53 74 61 74
  65 6D 65 6E  74 2E 53 79  6E 74 61 78  45 72 72 6F
  72 87 6D 65  73 73 61 67  65 D0 65 49  6E 76 61 6C
  69 64 20 69  6E 70 75 74  20 27 54 27  3A 20 65 78
  70 65 63 74  65 64 20 3C  69 6E 69 74  3E 20 28 6C
  69 6E 65 20  31 2C 20 63  6F 6C 75 6D  6E 20 31 20
  28 6F 66 66  73 65 74 3A  20 30 29 29  0A 22 54 68
  69 73 20 77  69 6C 6C 20  63 61 75 73  65 20 61 20
  73 79 6E 74  61 78 20 65  72 72 6F 72  22 0A 20 5E
  00 00

# Further requests are ignored
Client: PULL_ALL

  00 02 b0 3f 00 00

Server: IGNORED

  00 02 b0 7e 00 00


# Until the error is acknowledged
Client: ACK_FAILURE

  00 02 B0 0E  00 00

Server: SUCCESS {}

  00 03 b1 70  a0 00 00


# The transaction remains in place, and can be rolled back
Client: RUN "ROLLBACK" {}

  00 0C B2 10  88 52 4F 4C  4C 42 41 43  4B A0 00 00

Server: SUCCESS { "fields": [] }

  00 0B B1 70  A1 86 66 69  65 6C 64 73  90 00 00

Accessing basic result metadata

If your statement performs changes to the graph or the schema, the SUCCESS message at the end of the result stream will contain statistics describing a summary of the changes. It will also always contain a description of the type of statement ran - read (r), write (w), read/write (rw) or schema write (s).

Basic metadata 

# Handshake
Client: <connect>
Client: 60 60 B0 17
Client: 00 00 00 01  00 00 00 00  00 00 00 00  00 00 00 00
Server: 00 00 00 01

Client: INIT "MyClient/1.0" { "scheme": "basic", "principal": "neo4j", "credentials": "secret"}

  00 40 B1 01  8C 4D 79 43  6C 69 65 6E  74 2F 31 2E
  30 A3 86 73  63 68 65 6D  65 85 62 61  73 69 63 89
  70 72 69 6E  63 69 70 61  6C 85 6E 65  6F 34 6A 8B
  63 72 65 64  65 6E 74 69  61 6C 73 86  73 65 63 72
  65 74 00 00

Server: SUCCESS {}

  00 03 b1 70  a0 00 00

# Running a read-only statement will not return any statistics
Client: RUN "RETURN 1 AS num" {}

  00 13 B2 10  8F 52 45 54  55 52 4E 20  31 20 41 53
  20 6E 75 6D  A0 00 00

Server: SUCCESS { "fields": ["num"] }

  00 0f b1 70  A1 86 66 69  65 6C 64 73  91 83 6E 75
  6d 00 00

Client: PULL_ALL

  00 02 B0 3F  00 00

Server: RECORD [1]

  00 04 b1 71  91 01 00 00

Server: SUCCESS {
          "type": "r"
        }

  00 0A B1 70  A1 84 74 79  70 65 81 72  00 00

# Updating queries will return statistics that summarize all executed updates
Client: RUN "CREATE ()" {}

  00 0D B2 10  89 43 52 45  41 54 45 20  28 29 A0 00
  00

Server: SUCCESS { "fields": [] }

  00 0B B1 70  A1 86 66 69  65 6C 64 73  90 00 00

Client: PULL_ALL

  00 02 B0 3F  00 00

Server: SUCCESS {
          "type": "w",
          "stats": { "nodes-created": 1 }
        }

  00 20 B1 70  A2 84 74 79  70 65 81 77  85 73 74 61
  74 73 A1 8D  6E 6F 64 65  73 2D 63 72  65 61 74 65
  64 01 00 00

Explaining and profiling a query

Profiling and query explanation is a mechanism of the underlying query engine, meaning there is no explicit protocol mechanism to trigger these. Instead, profiling is triggered by prefixing your query with PROFILE, and explaining is triggered by prefixing your query with EXPLAIN. The resulting query plan is returned at the end of the result stream, with the profiling information embedded if you ran PROFILE.

Profile query 

# Handshake
Client: <connect>
Client: 60 60 B0 17
Client: 00 00 00 01  00 00 00 00  00 00 00 00  00 00 00 00
Server: 00 00 00 01

Client: INIT "MyClient/1.0" { "scheme": "basic", "principal": "neo4j", "credentials": "secret"}

  00 40 B1 01  8C 4D 79 43  6C 69 65 6E  74 2F 31 2E
  30 A3 86 73  63 68 65 6D  65 85 62 61  73 69 63 89
  70 72 69 6E  63 69 70 61  6C 85 6E 65  6F 34 6A 8B
  63 72 65 64  65 6E 74 69  61 6C 73 86  73 65 63 72
  65 74 00 00

Server: SUCCESS {}

  00 03 b1 70  a0 00 00

# Explaining the query will not execute it, so it returns an empty result and the query plan
Client: RUN "EXPLAIN RETURN 1 AS num" {}

  00 1C B2 10  D0 17 45 58  50 4C 41 49  4E 20 52 45
  54 55 52 4E  20 31 20 41  53 20 6E 75  6D A0 00 00

Server: SUCCESS { "fields": [] }

  00 0B B1 70  A1 86 66 69  65 6C 64 73  90 00 00

Client: PULL_ALL

  00 02 B0 3F  00 00

Server: SUCCESS {
          "type": "r",
          "plan": {
            "args": {
              "runtime-impl": "INTERPRETED",
              "planner-impl": "IDP",
              "version": "CYPHER 3.1",
              "KeyNames": "num",
              "EstimatedRows": 1.0,
              "planner": "COST",
              "runtime": "INTERPRETED"
            },
            "children": [{
              "args": {
                "LegacyExpression": "{  AUTOINT0}",
                "EstimatedRows": 1.0},
              "children": [],
              "identifiers": ["num"],
              "operatorType": "Projection"
            }],
            "identifiers": ["num"],
            "operatorType": "ProduceResults"
          }
        }

  01 3F B1 70  A2 84 74 79  70 65 81 72  84 70 6C 61
  6E A4 84 61  72 67 73 A7  8C 72 75 6E  74 69 6D 65
  2D 69 6D 70  6C 8B 49 4E  54 45 52 50  52 45 54 45
  44 8C 70 6C  61 6E 6E 65  72 2D 69 6D  70 6C 83 49
  44 50 87 76  65 72 73 69  6F 6E 8A 43  59 50 48 45
  52 20 33 2E  31 88 4B 65  79 4E 61 6D  65 73 83 6E
  75 6D 8D 45  73 74 69 6D  61 74 65 64  52 6F 77 73
  C1 3F F0 00  00 00 00 00  00 87 70 6C  61 6E 6E 65
  72 84 43 4F  53 54 87 72  75 6E 74 69  6D 65 8B 49
  4E 54 45 52  50 52 45 54  45 44 88 63  68 69 6C 64
  72 65 6E 91  A4 84 61 72  67 73 A2 D0  10 4C 65 67
  61 63 79 45  78 70 72 65  73 73 69 6F  6E 8C 7B 20
  20 41 55 54  4F 49 4E 54  30 7D 8D 45  73 74 69 6D
  61 74 65 64  52 6F 77 73  C1 3F F0 00  00 00 00 00
  00 88 63 68  69 6C 64 72  65 6E 90 8B  69 64 65 6E
  74 69 66 69  65 72 73 91  83 6E 75 6D  8C 6F 70 65
  72 61 74 6F  72 54 79 70  65 8A 50 72  6F 6A 65 63
  74 69 6F 6E  8B 69 64 65  6E 74 69 66  69 65 72 73
  91 83 6E 75  6D 8C 6F 70  65 72 61 74  6F 72 54 79
  70 65 8E 50  72 6F 64 75  63 65 52 65  73 75 6C 74
  73 00 00


# Profiling the query will execute it, and the returned plan now includes the number of rows emitted from
# each part of the plan, as well as the number of database primitive operations that were executed.
Client: RUN "PROFILE RETURN 1 AS num" {}

  00 1C B2 10  D0 17 50 52  4F 46 49 4C  45 20 52 45
  54 55 52 4E  20 31 20 41  53 20 6E 75  6D A0 00 00

Server: SUCCESS { "fields": ["num"] }

  00 0f b1 70  a1 86 66 69  65 6c 64 73  91 83 6e 75
  6d 00 00

Client: PULL_ALL

  00 02 B0 3F  00 00

Server: RECORD [1]

  00 04 b1 71  91 01 00 00

# Notice how this time, the response includes "profile" instead of "plan", which is a Plan tree with
# additional 'DbHits' and 'Rows' metrics in the plan description:
Server: SUCCESS {
          "type": "r",
          "profile": {
            "args": {
              "planner-impl": "IDP",
              "KeyNames":"num",
              "runtime":"INTERPRETED",
              "runtime-impl":"INTERPRETED",
              "version":"CYPHER 3.1",
              "EstimatedRows":1.0,
              "planner":"COST",
              "DbHits":0,
              "Rows":1
            },
            "operatorType":"ProduceResults",
            "rows":1,
            "children": [
              {
                "args": {
                  "LegacyExpression":"{  AUTOINT0}",
                  "EstimatedRows":1.0,
                  "DbHits":0,
                  "Rows":1
                },
                "operatorType":"Projection",
                "rows":1,
                "children":[],
                "dbHits":0,
                "identifiers":["num"]
              }
            ],
            "dbHits":0,
            "identifiers":["num"]
          }
        }

  01 7A B1 70  A2 84 74 79  70 65 81 72  87 70 72 6F
  66 69 6C 65  A6 84 61 72  67 73 A9 8C  70 6C 61 6E
  6E 65 72 2D  69 6D 70 6C  83 49 44 50  88 4B 65 79
  4E 61 6D 65  73 83 6E 75  6D 87 72 75  6E 74 69 6D
  65 8B 49 4E  54 45 52 50  52 45 54 45  44 8C 72 75
  6E 74 69 6D  65 2D 69 6D  70 6C 8B 49  4E 54 45 52
  50 52 45 54  45 44 87 76  65 72 73 69  6F 6E 8A 43
  59 50 48 45  52 20 33 2E  31 8D 45 73  74 69 6D 61
  74 65 64 52  6F 77 73 C1  3F F0 00 00  00 00 00 00
  87 70 6C 61  6E 6E 65 72  84 43 4F 53  54 86 44 62
  48 69 74 73  00 84 52 6F  77 73 01 8C  6F 70 65 72
  61 74 6F 72  54 79 70 65  8E 50 72 6F  64 75 63 65
  52 65 73 75  6C 74 73 84  72 6F 77 73  01 88 63 68
  69 6C 64 72  65 6E 91 A6  84 61 72 67  73 A4 D0 10
  4C 65 67 61  63 79 45 78  70 72 65 73  73 69 6F 6E
  8C 7B 20 20  41 55 54 4F  49 4E 54 30  7D 8D 45 73
  74 69 6D 61  74 65 64 52  6F 77 73 C1  3F F0 00 00
  00 00 00 00  86 44 62 48  69 74 73 00  84 52 6F 77
  73 01 8C 6F  70 65 72 61  74 6F 72 54  79 70 65 8A
  50 72 6F 6A  65 63 74 69  6F 6E 84 72  6F 77 73 01
  88 63 68 69  6C 64 72 65  6E 90 86 64  62 48 69 74
  73 00 8B 69  64 65 6E 74  69 66 69 65  72 73 91 83
  6E 75 6D 86  64 62 48 69  74 73 00 8B  69 64 65 6E
  74 69 66 69  65 72 73 91  83 6E 75 6D  00 00

Accessing notifications

When Neo4j executes a statement it may include notifications for the user. These notifications can be warnings about problematic statements or other valuable information for a client. Notifications are only included when using EXPLAIN.

Notifications 

# Handshake
Client: <connect>
Client: 60 60 B0 17
Client: 00 00 00 01  00 00 00 00  00 00 00 00  00 00 00 00
Server: 00 00 00 01

Client: INIT "MyClient/1.0" { "scheme": "basic", "principal": "neo4j", "credentials": "secret"}

  00 40 B1 01  8C 4D 79 43  6C 69 65 6E  74 2F 31 2E
  30 A3 86 73  63 68 65 6D  65 85 62 61  73 69 63 89
  70 72 69 6E  63 69 70 61  6C 85 6E 65  6F 34 6A 8B
  63 72 65 64  65 6E 74 69  61 6C 73 86  73 65 63 72
  65 74 00 00

Server: SUCCESS {}

  00 03 B1 70  A0 00 00

# Sending a statement that would result in notifications
Client: RUN "EXPLAIN MATCH (n), (m) RETURN n, m" {}
  00 27 B2 10  D0 22 45 58  50 4C 41 49  4E 20 4D 41
  54 43 48 20  28 6E 29 2C  20 28 6D 29  20 52 45 54
  55 52 4E 20  6E 2C 20 6D  A0 00 00

Server: SUCCESS { "fields": [] }

  00 0B B1 70  A1 86 66 69  65 6C 64 73  90 00 00

Client: PULL_ALL

  00 02 B0 3F  00 00

# Notifications are included in the response and each of them consists of `code`, `title` and `description`. A notification might also include `position` to indicate where the notification arises if it is applicable.
Server: SUCCESS {
          "type": "r",
          "plan": {
            "args": {
              "runtime-impl": "INTERPRETED",
              "planner-impl": "IDP",
              "version": "CYPHER 3.1",
              "KeyNames": "n, m",
              "EstimatedRows": 0.0,
              "planner": "COST",
              "runtime": "INTERPRETED"
            },
            "children": [{
              "args": {"EstimatedRows": 0.0},
              "children": [{
                "args": {"EstimatedRows": 0.0},
                "children": [],
                "identifiers": ["n"],
                "operatorType": "AllNodesScan"
                },{
                "args": {"EstimatedRows": 0.0},
                "children": [],
                "identifiers": ["m"],
                "operatorType": "AllNodesScan"
              }],
              "identifiers": ["m", "n"],
              "operatorType": "CartesianProduct"
            }],
            "identifiers": ["m", "n"],
            "operatorType": "ProduceResults"
          },
          "notifications": [{
            "severity": "WARNING",
            "title": "This query builds a cartesian product between disconnected patterns.",
            "code": "Neo.ClientNotification.Statement.CartesianProductWarning",
            "description": "If a part of a query contains multiple disconnected patterns, this will build a cartesian product between all those parts. This may produce a large amount of data and slow down query processing. While occasionally intended, it may often be possible to reformulate the query that avoids the use of this cross product, perhaps by adding a relationship between the different parts or by using OPTIONAL MATCH (identifier is: (m))",
            "position": {
              "offset": 0, "column": 1, "line": 1
            }
          }]
        }

  04 4E B1 70  A3 84 74 79  70 65 81 72  84 70 6C 61
  6E A4 84 61  72 67 73 A7  8C 72 75 6E  74 69 6D 65
  2D 69 6D 70  6C 8B 49 4E  54 45 52 50  52 45 54 45
  44 8C 70 6C  61 6E 6E 65  72 2D 69 6D  70 6C 83 49
  44 50 87 76  65 72 73 69  6F 6E 8A 43  59 50 48 45
  52 20 33 2E  31 88 4B 65  79 4E 61 6D  65 73 84 6E
  2C 20 6D 8D  45 73 74 69  6D 61 74 65  64 52 6F 77
  73 C1 00 00  00 00 00 00  00 00 87 70  6C 61 6E 6E
  65 72 84 43  4F 53 54 87  72 75 6E 74  69 6D 65 8B
  49 4E 54 45  52 50 52 45  54 45 44 88  63 68 69 6C
  64 72 65 6E  91 A4 84 61  72 67 73 A1  8D 45 73 74
  69 6D 61 74  65 64 52 6F  77 73 C1 00  00 00 00 00
  00 00 00 88  63 68 69 6C  64 72 65 6E  92 A4 84 61
  72 67 73 A1  8D 45 73 74  69 6D 61 74  65 64 52 6F
  77 73 C1 00  00 00 00 00  00 00 00 88  63 68 69 6C
  64 72 65 6E  90 8B 69 64  65 6E 74 69  66 69 65 72
  73 91 81 6E  8C 6F 70 65  72 61 74 6F  72 54 79 70
  65 8C 41 6C  6C 4E 6F 64  65 73 53 63  61 6E A4 84
  61 72 67 73  A1 8D 45 73  74 69 6D 61  74 65 64 52
  6F 77 73 C1  00 00 00 00  00 00 00 00  88 63 68 69
  6C 64 72 65  6E 90 8B 69  64 65 6E 74  69 66 69 65
  72 73 91 81  6D 8C 6F 70  65 72 61 74  6F 72 54 79
  70 65 8C 41  6C 6C 4E 6F  64 65 73 53  63 61 6E 8B
  69 64 65 6E  74 69 66 69  65 72 73 92  81 6D 81 6E
  8C 6F 70 65  72 61 74 6F  72 54 79 70  65 D0 10 43
  61 72 74 65  73 69 61 6E  50 72 6F 64  75 63 74 8B
  69 64 65 6E  74 69 66 69  65 72 73 92  81 6D 81 6E
  8C 6F 70 65  72 61 74 6F  72 54 79 70  65 8E 50 72
  6F 64 75 63  65 52 65 73  75 6C 74 73  8D 6E 6F 74
  69 66 69 63  61 74 69 6F  6E 73 91 A5  88 73 65 76
  65 72 69 74  79 87 57 41  52 4E 49 4E  47 85 74 69
  74 6C 65 D0  44 54 68 69  73 20 71 75  65 72 79 20
  62 75 69 6C  64 73 20 61  20 63 61 72  74 65 73 69
  61 6E 20 70  72 6F 64 75  63 74 20 62  65 74 77 65
  65 6E 20 64  69 73 63 6F  6E 6E 65 63  74 65 64 20
  70 61 74 74  65 72 6E 73  2E 84 63 6F  64 65 D0 38
  4E 65 6F 2E  43 6C 69 65  6E 74 4E 6F  74 69 66 69
  63 61 74 69  6F 6E 2E 53  74 61 74 65  6D 65 6E 74
  2E 43 61 72  74 65 73 69  61 6E 50 72  6F 64 75 63
  74 57 61 72  6E 69 6E 67  8B 64 65 73  63 72 69 70
  74 69 6F 6E  D1 01 A9 49  66 20 61 20  70 61 72 74
  20 6F 66 20  61 20 71 75  65 72 79 20  63 6F 6E 74
  61 69 6E 73  20 6D 75 6C  74 69 70 6C  65 20 64 69
  73 63 6F 6E  6E 65 63 74  65 64 20 70  61 74 74 65
  72 6E 73 2C  20 74 68 69  73 20 77 69  6C 6C 20 62
  75 69 6C 64  20 61 20 63  61 72 74 65  73 69 61 6E
  20 70 72 6F  64 75 63 74  20 62 65 74  77 65 65 6E
  20 61 6C 6C  20 74 68 6F  73 65 20 70  61 72 74 73
  2E 20 54 68  69 73 20 6D  61 79 20 70  72 6F 64 75
  63 65 20 61  20 6C 61 72  67 65 20 61  6D 6F 75 6E
  74 20 6F 66  20 64 61 74  61 20 61 6E  64 20 73 6C
  6F 77 20 64  6F 77 6E 20  71 75 65 72  79 20 70 72
  6F 63 65 73  73 69 6E 67  2E 20 57 68  69 6C 65 20
  6F 63 63 61  73 69 6F 6E  61 6C 6C 79  20 69 6E 74
  65 6E 64 65  64 2C 20 69  74 20 6D 61  79 20 6F 66
  74 65 6E 20  62 65 20 70  6F 73 73 69  62 6C 65 20
  74 6F 20 72  65 66 6F 72  6D 75 6C 61  74 65 20 74
  68 65 20 71  75 65 72 79  20 74 68 61  74 20 61 76
  6F 69 64 73  20 74 68 65  20 75 73 65  20 6F 66 20
  74 68 69 73  20 63 72 6F  73 73 20 70  72 6F 64 75
  63 74 2C 20  70 65 72 68  61 70 73 20  62 79 20 61
  64 64 69 6E  67 20 61 20  72 65 6C 61  74 69 6F 6E
  73 68 69 70  20 62 65 74  77 65 65 6E  20 74 68 65
  20 64 69 66  66 65 72 65  6E 74 20 70  61 72 74 73
  20 6F 72 20  62 79 20 75  73 69 6E 67  20 4F 50 54
  49 4F 4E 41  4C 20 4D 41  54 43 48 20  28 69 64 65
  6E 74 69 66  69 65 72 20  69 73 3A 20  28 6D 29 29
  88 70 6F 73  69 74 69 6F  6E A3 86 6F  66 66 73 65
  74 00 86 63  6F 6C 75 6D  6E 01 84 6C  69 6E 65 01
  00 00

Resetting the session

This illustrates how to reset the session to a "clean" state.

Resetting 

# Handshake
Client: <connect>
Client: 60 60 B0 17
Client: 00 00 00 01  00 00 00 00  00 00 00 00  00 00 00 00
Server: 00 00 00 01

Client: INIT "MyClient/1.0" { "scheme": "basic", "principal": "neo4j", "credentials": "secret"}

  00 40 B1 01  8C 4D 79 43  6C 69 65 6E  74 2F 31 2E
  30 A3 86 73  63 68 65 6D  65 85 62 61  73 69 63 89
  70 72 69 6E  63 69 70 61  6C 85 6E 65  6F 34 6A 8B
  63 72 65 64  65 6E 74 69  61 6C 73 86  73 65 63 72
  65 74 00 00

Server: SUCCESS {}

  00 03 b1 70  a0 00 00

# Batch of messages
Client: RUN "RETURN 1 AS num" {}

  00 13 b2 10  8f 52 45 54  55 52 4e 20  31 20 41 53
  20 6e 75 6d  a0 00 00

# Server responses
Server: SUCCESS { "fields": ["num"] }

  00 0f b1 70  a1 86 66 69  65 6c 64 73  91 83 6e 75
  6d 00 00

Client: RESET {}

  00 02 b0 0f  00 00

Server: SUCCESS {}

  00 03 b1 70  a0 00 00