#35 implement heartbeatInfo event on connection

This commit is contained in:
Nicolas Dextraze
2017-05-15 12:55:14 -07:00
parent 917b89cf3d
commit 121e248dd8
5 changed files with 42 additions and 5 deletions

View File

@ -29,6 +29,11 @@ const connection = client.createConnection(settings, endpoint)
connection.connect().catch(err => console.log(err))
connection.on('heartbeatInfo', heartbeatInfo => {
console.log('Connected to endpoint', heartbeatInfo.remoteEndPoint)
console.log('Heartbeat latency', heartbeatInfo.responseReceivedAt - heartbeatInfo.requestSentAt)
})
connection.once("connected", tcpEndPoint => {
console.log(`Connected to eventstore at ${tcpEndPoint.host}:${tcpEndPoint.port}`)
connection.subscribeToAll(