@mhmd It's a function of your router's network address translation (NAT). It's the same way your browser can get push notifications (as from this forum).
When your Sonoff device communicates with the Chinese server, your router uses a different port number and stores that info. When traffic comes in to your external IP address with that port number the router knows which internal IP address and port to send it to.
You can read more about NAT elsewhere.
The bottom line is that the Chinese server isn't getting special access to your network and doesn't know your local IP address.