export default function createWebSocket(url, onMessageCallback) {
    const socket = new WebSocket(url);
  
    socket.addEventListener('message', (event) => {
      const jsonData = JSON.parse(event.data);
      onMessageCallback(jsonData);
      //console.log(jsonData)
    });
  
    return socket;
  }