forked from ChipaDevTeam/BinaryOptionsTools-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathraw_send.js
More file actions
32 lines (24 loc) · 871 Bytes
/
Copy pathraw_send.js
File metadata and controls
32 lines (24 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Sends raw WebSocket messages without waiting for a response.
//
// node raw_send.js "<ssid>"
const { PocketOption } = require("../../nodejs");
async function main(ssid) {
const api = await PocketOption.create(ssid);
await api.sendRaw('42["signals/subscribe"]');
console.log("Sent signals subscription message");
await api.sendRaw('42["price/subscribe"]');
console.log("Sent price subscription message");
const messages = [
'42["chart/subscribe",{"asset":"EURUSD"}]',
'42["trades/subscribe"]',
'42["notifications/subscribe"]',
];
for (const message of messages) {
await api.sendRaw(message);
console.log(`Sent message: ${message}`);
await new Promise((resolve) => setTimeout(resolve, 1000));
}
await api.shutdown();
}
const ssid = process.argv[2] || process.env.POCKET_OPTION_SSID;
main(ssid).catch(console.error);