Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Spotware - Example: Client

node v12.22.12
version: 3.0.0
endpointsharetweet
const tls = require("tls"); const { SpotwareClientSocket, ProtoOAPayloadType, FACTORY, } = require("@claasahl/spotware-adapter"); const host = "demo.ctraderapi.com"; const port = 5035; const socket = tls.connect(port, host); socket.once("secureConnect", () => { console.log(`requesting version number from ${host}:${port}`); s.write(FACTORY.PROTO_OA_VERSION_REQ()) }); const s = new SpotwareClientSocket(socket); s.on("data", (message) => { switch (message.payloadType) { case ProtoOAPayloadType.PROTO_OA_VERSION_RES: console.log(`got response from ${host}:${port}`); console.log(`server version: ${message.payload.version}`); s.end(); break; // ... } });
Loading…

no comments

    sign in to comment