socket.io client in -react - kubernetes cluster

43 Views Asked by At

i have one of the service in microservices called us chat-service .when i build localy the chat-service listening on port 4003 so in backend i used for chating socket.io and client side socket-client .when client try to connect the backend port of chat-srv i have configred like this io(http://localhost:4003)..but i everything move k8s digital ocean cluster ..it might be confused because after creating ingress-api gatewy everyhting work as expected ..but in case of socket-client try to find the backend chat-srvice listening path ..i have created service and deployment object for chat-service..but k8s service object is not accesble externaly right. so How could solve this issue , which url i could give there like io("url") (my domain i connected my cluster ip to domain "https://flyway.website" everthing work now under the domain)

export const useSocket = () => {

    const [socket, setSocket] = useState(null)

    useEffect(() => {
        const newSocket = io("which url i could be use here instead of using http://localhost:4003")
        
        setSocket(newSocket)
        return () => {
            newSocket.disconnect()
        }

    }, [])

    return socket

}

if you have any idea about this please share to here ..that will be more helpful more me

0

There are 0 best solutions below