Removed deprecations + merge message-status-update into chat-update

1. Update package version to 4.0.0
2. Retry query if the connection unexpectedly closes + make query iterative instead of recursive
3. Remove message-new & message-update deprecations
4. Deprecate loadProfilePicturesForChatsAutomatically
This commit is contained in:
Adhiraj Singh
2021-01-04 12:35:48 +05:30
parent 05bae6b1e7
commit ac4b4c7384
9 changed files with 157 additions and 221 deletions

View File

@@ -372,4 +372,21 @@ describe ('Pending Requests', () => {
conn.close ()
})
it('should re-execute query on connection closed error', async () => {
const conn = makeConnection ()
//conn.pendingRequestTimeoutMs = 10_000
await conn.loadAuthInfo('./auth_info.json').connect ()
const task: Promise<any> = conn.query({json: ['query', 'Status', conn.user.jid], waitForOpen: true})
await delay(20)
conn['onMessageRecieved']('1234,["Pong",false]') // fake cancel the connection
await delay(2000)
const json = await task
assert.ok (json.status)
conn.close ()
})
})