useEffect(() => {
   let socket = new WebSocket('wss://stream.graff.tech:13001')
   setSocket(socket)
   socket.onopen = () => {
     socket.send('{"message" : "NEW_USER"}')
     setConnected(true)
   }

   socket.onmessage = (e) => {
     const response = JSON.parse(e.data)
     console.log(response, 'res')
     switch (response.message) {
       case 'NEW_USER':
         console.log('user');
         break

       case 'SESS_CREATION':
         setData({ id: response.id, port: response.port })
         history.push(`/stream/${response.id}`)
         break

       case 'SESS_CONNECT':
         setData({ id: response.id, port: response.content })
         break

       case 'SESS_NOT_EXISTS':
         break
     }
   }

   socket.onclose = () => {
     socket.close()
     setConnected(false)
   };

   socket.onerror = () => {
     console.log("WS Error");
     setConnected(false)
   };
 }, [])
