InfinityFree doesn’t support WebSockets. It’s only designed for websites that are accessed by web browsers over HTTP or HTTPS, and there’s a security system that helps to ensure that.
InfinityFree also doesn’t support Node.js. The only server-side language that’s supported is PHP (client-side javascript is fine though).