Wix doesn’t support long running processes like web sockets so what’s going to happen here is the server will run for a short period of time and then terminate.
Besides wix-realtime the other option you have is wix-http-functions https://www.wix.com/velo/reference/wix-http-functions/introduction . This can be used to define REST endpoints that your site can respond to.