Websocket connection fails in docker network

I am trying to develop an app with apollo graphql server and react. i susbscribe to apollo server from react container(visualization) and consume data. If i map ports of apollo server, i can connect to apollo server and react app works fine but if i expose port in docker compose file, connection fails. I cant understand why this happens, normally within the same network containers can talk each other and i haven’t faced similar problems before.

Orijinal Question : Apollo Server WebSocket Connection Docker Compose Expose Problem - Stack Overflow