when i try to call this function after websocket initialize, ws.onmessage event isn't fire so that data value is not change
let data;
async function spin(betAmount) {
let development;
await fetch('../config.json')
.then(response => response.json())
.then(dev => development = dev.development)
if(wsConnection === null) {
wsConnection = new WebSocket(development.wss_url)
wsConnection.onopen = () => {
console.log('WebSocket connection initialize')
}
} else {
wsConnection.onmessage = (event) => {
data = event.data
}
console.log(wsConnection.onmessage)
console.log(data)
}
}