Yes, but the heavy lifting required behind the scenes to make statecharts work seems quite elaborate, moreover it could be problematic to use blocking apis, like sockets etc with statecharts, perhaps?
With the next request, reload the “current” state of the machine and transition to the next based on the incoming request.
Rinse/repeat.