File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,9 @@ The copy commands are not supported.
267
267
const result = client .query ({text: ... , transform: camelcase })
268
268
```
269
269
270
+ 3 . _ How do I use LISTEN/NOTIFY?_ Send ` LISTEN ` as a regular query, then subscribe to notifications
271
+ using ` on(event: 'notification', callback: Callback<Notification>) ` .
272
+
270
273
## Benchmarking
271
274
272
275
Use the following environment variable to run tests in "benchmark" mode.
Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ export class Client {
289
289
const startup = ( stream ?: Socket ) => {
290
290
if ( stream ) this . stream = stream ;
291
291
writer . startup ( settings ) ;
292
- this . listen ( ) ;
292
+ this . receive ( ) ;
293
293
this . sendUsing ( writer ) ;
294
294
}
295
295
@@ -344,13 +344,13 @@ export class Client {
344
344
} ) ;
345
345
} else {
346
346
writer . startup ( settings ) ;
347
- this . listen ( ) ;
347
+ this . receive ( ) ;
348
348
}
349
349
350
350
this . sendUsing ( writer ) ;
351
351
}
352
352
353
- private listen ( ) {
353
+ private receive ( ) {
354
354
let buffer : Buffer | null = null ;
355
355
let offset = 0 ;
356
356
let remaining = 0 ;
@@ -376,7 +376,7 @@ export class Client {
376
376
}
377
377
378
378
try {
379
- const read = this . receive ( buffer , offset , size ) ;
379
+ const read = this . handle ( buffer , offset , size ) ;
380
380
offset += read ;
381
381
remaining = size - read ;
382
382
} catch ( error ) {
@@ -826,7 +826,7 @@ export class Client {
826
826
throw new Error ( 'Unable to parse error message.' ) ;
827
827
}
828
828
829
- private receive ( buffer : Buffer , offset : number , size : number ) : number {
829
+ private handle ( buffer : Buffer , offset : number , size : number ) : number {
830
830
const types = this . config . types || null ;
831
831
let read = 0 ;
832
832
You can’t perform that action at this time.
0 commit comments