Client/Script communication

This part of the documentation described the internal communication protocol of Gubed.

The script opens a TCP/IP connection to the host on the configured port, then it await's orders. To the script, it's transparent wether a proxy is used or not.

The client either waits for incoming connections, or does a connect itself if the proxy is used.

The proxy does nothing but forwarding the data between the script and the client.

Commands are sent in the forms of “command:datalength;data”. The data is in the form of a php serialized array with only string keys and only string or integer values.

So to send the command that tells the client about what the current file and line is, the scripts will send “activeline:98;a:2:{s:4:"line";i:0;s:8:"filename";s:53:"/mnt/hdc1/projects/mccwms2/sites/linus/html/index.php";}”.

The client can then parse the serialized array for arguments it needs, in this case “filename” and “line

The client sends commands to the script in the same way.