Here's an idea, although it may not scale very well:
The basic idea is that you want the proxy server of these raw socket connections in some way when the connection to the backend system is saved.
, , , , (fifo), - , session_id. .
, . , PHP, (: php, nanoserv System_Deamon), , . , - , fork() .
, - , , PHP-. , -, , , session_id.
/ , , . - - ( - /, ), .