Skip to content

Commit ff3fec2

Browse files
committed
Mention the need to close driver in the readme
1 parent e4289d7 commit ff3fec2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ To get the latest stable release omit `@next` part altogether or use `@latest` i
3131
```javascript
3232
var neo4j = require('neo4j-driver').v1;
3333
```
34+
Driver instance should be closed when Node.js application exits:
35+
36+
```javascript
37+
driver.close();
38+
```
39+
40+
otherwise application shutdown might hang or it might exit with a non-zero exit code.
3441

3542
## Include in web browser
3643

@@ -46,6 +53,14 @@ This will make a global `neo4j` object available, where you can access the `v1`
4653
var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "neo4j"));
4754
```
4855

56+
It is not required to explicitly close the driver on a web page. Web browser should gracefully close all open
57+
WebSockets when the page is unloaded. However, driver instance should be explicitly closed when it's lifetime
58+
is not the same as the lifetime of the web page:
59+
60+
```javascript
61+
driver.close();
62+
```
63+
4964
## Usage examples
5065

5166
```javascript

0 commit comments

Comments
 (0)