Subject: | Re: Grrrr dynamic scoping in PAL
| Date: | Sun, 16 Sep 2018 11:12:19 +1000
| From: | Bernie van't Hof <berniev@bje.com.au>
| Newsgroups: | pnews.paradox-dos
|
In case you are curious:
index.php sets up a basic screen and initiates a websocket connection.
As each new incoming websocket client connection is made, a new listening socket is created
for that client and a
corresponding new instance of php started using php's 'proc_open()' (Execute a command and open
file pointers for
input/output).
$this->proc = proc_open($cmd, $procDescriptor, $pipes, $cwd, $env);
where $cmd is essentially
php sshost.php addr port clNum
sshost.php creates a socket connection at the indicated port and starts the app.
----------+------+---------+------+------------------------+--------+----------+
http | port | browser | port | websocket | port | app |
server | 80 | | 8001 | server | 8002+N | instance |
| | | +--------+------+--------+ | |
| | | | ws | port | app | | |
| | | | client | N/A | client | | |
----------+------+---------+------+--------+------+--------+--------+----------+
| ==> | 1 | <==> | 1 | <==> | 1 | <==> |
1 |
index.php | ==> | 2 | <==> | 2 | <==> | 2 | <==> |
2 |
px.js | | ... | | ... | | ... | | ... |
| ==> | N | <==> | N | <==> | N | <==> |
N |
----------+------+---------+------+--------+------+--------+--------+----------+
Tha app's I/O is through its port.
px.js javascript handles browser I/O and websocket comms.
- Bernie
On 14/9/18 6:18 am, Larry DiGiovanni wrote:
> Bernie van't Hof wrote:
>
>> First things first. Dynamic typing is quite common in scripting languages and makes
them infinitely easier to use than
>> many strongly typed languages.
>
> Yes, I was referring to both at once (scope and type), particularly when a large application
is in play. PAL could've
> improved things with some sort of OPTION EXPLICIT... thing.
>
>> As each new client (tab or user) makes a connection to the websocket server it is routed
to a completely new instance
>> of php to talk to and the app instantiated in that instance. So they are completely
separate. The talk between the
>> websocket server and each instance of php is via separate socket connection. Its fast.
Globals are unique to each
>> instance of php.
>
> This was the answer to my question. I really have two barriers to diving in deeper to
your code. One is I don't have
> time. Two is I don't know PHP, and lack the time to become familiar enough with it (See
One).
>
> --
> Larry DiGiovanni
|