measure ws connect time

This commit is contained in:
slice 2018-07-18 12:24:48 -07:00
parent df3f5e170b
commit 7f6e946c2b
No known key found for this signature in database
GPG Key ID: 1508C19D7436A26D
1 changed files with 3 additions and 1 deletions

View File

@ -49,13 +49,15 @@ export default class StreamingClient extends NanoEvents {
}
connect () {
const begin = Date.now()
log('connecting')
const ws = this.ws = new WebSocket(this.url)
window.ws = ws
ws.onopen = () => {
log('connected')
const took = Date.now() - begin
log(`connected (took ${took}ms)`)
this.subscribe()
}