Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const MBSymbols = (function () {
} else if (website_status.website_status.clients_country === 'jp' || getLanguage() === 'JA') {
req.landing_company = 'japan';
}
BinarySocket.send(req);
BinarySocket.send(req, false, 'active_symbols');
need_page_update = update;
});
};
Expand Down
17 changes: 14 additions & 3 deletions src/javascript/binary/websocket_pages/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ const BinarySocketClass = function() {
'get_settings',
'residence_list',
'landing_company',
'payout_currencies',
];
let sent_requests = [];
const waiting_list = {
items: {},
add : (msg_type, promise_obj) => {
Expand Down Expand Up @@ -125,17 +127,25 @@ const BinarySocketClass = function() {
return promise_obj.promise;
};

const send = function(data, force_send) {
const send = function(data, force_send, msg_type) {
const promise_obj = new PromiseClass();

if (!force_send) {
const msg_type = no_duplicate_requests.find(c => c in data);
msg_type = msg_type || no_duplicate_requests.find(c => c in data);
if (!force_send && msg_type) {
const last_response = State.get(['response', msg_type]);
if (last_response) {
promise_obj.resolve(last_response);
return promise_obj.promise;
} else if (sent_requests.indexOf(msg_type) >= 0) {
return wait(msg_type).then((response) => {
promise_obj.resolve(response);
return promise_obj.promise;
});
}
}
if (msg_type) {
sent_requests.push(msg_type);
}

if (!data.req_id) {
data.req_id = ++req_id;
Expand Down Expand Up @@ -345,6 +355,7 @@ const BinarySocketClass = function() {

binarySocket.onclose = function () {
authorized = false;
sent_requests = [];
clearTimeouts();

if (!manualClosed && wrongAppId !== getAppId()) {
Expand Down