Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ashdaily opened this issue Jan 9, 2018 · 0 comments

Comments

@ashdaily
Copy link

ashdaily commented Jan 9, 2018

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();

@ashdaily ashdaily changed the title when i try to send multiple create requests at the same time, it would simply miss some responses back. when i try to send multiple create requests at the same time, it would simply miss some responses that i usually get back. Jan 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant