Skip to content

Commit

Permalink
feat: Add 'connecting' event
Browse files Browse the repository at this point in the history
As described in the [comment here](#7 (comment)), a "connecting" event is useful for monkey-patching the authentication process in lieu of a more official API.

Seems like this is a no-brainer addition.
  • Loading branch information
tommoor committed Oct 15, 2020
1 parent 5a36d77 commit 72c9978
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/y-websocket.js
Expand Up @@ -84,6 +84,11 @@ const setupWS = provider => {
provider.wsconnecting = true
provider.wsconnected = false
provider.synced = false

provider.emit('status', [{
status: 'connecting'
}])

websocket.onmessage = event => {
provider.wsLastMessageReceived = time.getUnixTime()
const encoder = readMessage(provider, new Uint8Array(event.data), true)
Expand Down

0 comments on commit 72c9978

Please sign in to comment.