measure ws connect time

This commit is contained in:
Skip R. 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

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()
}