Salamek / huawei-lte-api-ts

API For huawei LAN/WAN LTE Modems written in TypeScript
GNU Lesser General Public License v3.0
48 stars 19 forks source link

Concurrent request at API causes 125002: Session error #28

Open zinen opened 1 year ago

zinen commented 1 year ago

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:password@192.168.8.1/');
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()
Salamek commented 1 year ago

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