How to get quote after subscribe instrument in browser

Rupeshpr77
Hi Team
I am trying to populate instrument quote on web browser but getting this "Blob { size: 1, type: "" }
web3.html:79:21"

Please let me know solutions
code
<!DOCTYPE html>



WebSocket demo

body {
font-family: "Courier New", sans-serif;
text-align: center;
}

.buttons {
font-size: 4em;
display: flex;
justify-content: center;
}

.button,
.value {
line-height: 1;
padding: 2rem;
margin: 2rem;
border: medium solid;
min-height: 1em;
min-width: 1em;
}

.button {
cursor: pointer;
user-select: none;
}

.subscribe {
color: red;
}

.mode {
color: green;
}











subscribe


mode




var subscribe = document.querySelector('.subscribe'),
mode = document.querySelector('.mode'),

websocket = new WebSocket("wss://ws.kite.trade?api_key=xxx&access_token=xxx");

subscribe.onclick = function (event) {
console.log("subscribe clicked")

websocket.send(JSON.stringify({ "a": "subscribe", "v": [408065, 884737] }));
}
mode.onclick = function (event) {
console.log("mode clicked")
websocket.send(JSON.stringify({"a": "mode", "v": ["ltp", [408065]]}));
}
websocket.onmessage = function (event) {
console.log(event.data)



};



Tagged:
Sign In or Register to comment.