huawei-lte-api-ts icon indicating copy to clipboard operation
huawei-lte-api-ts copied to clipboard

Concurrent request at API causes 125002: Session error

Open zinen opened this issue 2 years ago • 1 comments

It seems that if requesting data using the same session but requesting varied data via concurrent 2-3 request causes a 125002: Session error. I figure maybe a queue system of some sort could be implemented?

I cant code typescript so no PR from me this time...

Example code that causes trouble:

const huaweiLteApi = require('huawei-lte-api');
const connection = new huaweiLteApi.Connection('http://admin:[email protected]/');
async function start() {
    try {
        await connection.ready()
        const device = new huaweiLteApi.Device(connection);
        const dialUp = new huaweiLteApi.DialUp(connection)
        const getTheeDataPoints = await Promise.all([device.signal(), device.information(), dialUp.mobileDataswitch()])
        console.log(getTheeDataPoints)
    } catch (error) {
        console.error(error.message);
    }
}
start()

zinen avatar Jan 25 '23 20:01 zinen

Hmm i'm not sure if that is something we should be solving in this library? I would suggest implement some kind of queue in your implementation for now... Ill will keep this issue open for now

Salamek avatar Jan 25 '23 23:01 Salamek