Skip to content

when i try to send multiple create requests at the same time, it would simply miss some responses that i usually get back.  #37

@ashdaily

Description

@ashdaily

The socket channel-api works perfectly for one user at one point of time. But when i test it using a forloop, it would simply block the create request. So for the time being the only solution i could find is send one request and wait for 500 seconds. It's working now but i am worried about cases where many user will send create requests at the same point of time then it might miss few orders.

var i = 1;
function myLoop() {
setTimeout(function() {
var conn = new WebSocket('ws://54.238.247.144:5000/');
conn.onmessage = function(e) {
console.log(e.data);
};
var msg = {
stream: "ipad_orders",
payload: {
action: "create",
data: {
"unique_id": "123",
"push_token": "11",
"machine_id": 342,
"machine_name": "ok1",
"parlour": "parlour1",
"total_cost": 333,
"membership": false,
"delivered": false,
"items": "Hello" + i,
"qty": "1",
}
}
}
conn.onopen = () => conn.send(JSON.stringify(msg));
console.log("Sended" + i)
i++;
if (i < 10) {
myLoop();
}
}, 500)
}
myLoop();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions