I'm building a small game that will be driven by web socket using SignalR on one hand and Azure function app on the other hand. Basically, the user establishes a web socket connection with the server and sends/receives a message from it. This is mainly done this way because players can discuss with each other in real-time.
Besides, I'd like to have some Azure function apps that run and execute some instructions. For example, every minute, an app would make some monsters move. If these monsters are around a specific player, I'd like him to know.
For this, I have two solutions in mind:
- Requesting the information every second from the client and then warning the user if he needs to be.
- Opening a connection to my web socket from within my function app to send the data and the hub would forward the information to affected users.
The first option kind of defeat the purpose of a web socket to me. What's the point of having web socket if I need to poll the server for some information.
The second option seems better but as I'm not familiar with function apps yet, I'm wondering if it's the way to go. Is it possible/correct to open a web socket connection from a function app?
Maybe there are some better options?
