Question: I have an azure WebApp and an Azure function App running in premium app service. Both have VNET integration with an Vnet hosting the Database.
My WebApp has public access but the function app should only be triggered from the Webapp and not publicly.
How can I restrict access to the function app? Will a service endpoint be needed?

Answer: 
connect io and on socket `connect` get `socket.id`

```
const socket = io.connect('http://localhost:5000');
socket.on("connect", () => {
  console.log(socket.id);
});

```
I believe need to wait for the `connect` first:

```
useEffect(() => {
  socketRef.current = io.connect('http://localhost:5000')
  socketRef.current.on('connect', ()=> {
  console.log(socketRef.current.socket.sessionid);
});
    }, []);

```