You can check how it's implemented in open source projects. One example that's very close to your requirements is in Vito Deploy:
It's a headless console where users input commands and get output in real time via SSE.
im building a vpn app admin panel and i have a page where im showing stats of a vps server through ssh using phpseclib but now i want to add an interactive full shell behaivour terminal there through which i can easily run cmds like stateful terminal/shell session
im using laravel with inertia with react and later need to implement this in livewire too but not now
Please or to participate in this conversation.