First working version os getFromWs function