This file describes the IPC protocol used for the PHP <-> Lazarus communication.
This protocol is based on JSON RPC.
Each message needs to be terminated by NULL character (PHP = "\0", Lazarus = #0). This will be used to identify each message on the stream.
{
"id": 2,
"method": "createObject",
"params": [
{
"lazarusClass": "TButton",
"lazarusObjectId": 1,
"parent": 0
}
]
}
{
"id": 2,
"result": 123
}
{
"method": "eventCallback",
"params": [
{
"name": "Click",
"target": 123
}
]
}
Request:
{
"id": 2,
"method": "createObject",
"params": [
{
"lazarusClass": "TButton",
"lazarusObjectId": 123,
"parent": 0
}
]
}
Response:
{
"id": 2,
"result": 123 // This is the object ID
}
{
"id": 2,
"method": "setObjectProperty",
"params": [
lazarusObjectId,
"propertyName",
"propertyValue"
]
}
Response:
{
"id": 2,
"result": true
}
{
"id": 2,
"method": "setObjectEventListener",
"params": [
lazarusObjectId,
"eventName"
]
}
Response:
{
"id": 2,
"result": true
}
{
"callback":false,
"id":134,
"method":"getObjectProperty",
"params":[
14,
"itemIndex"
]
}
Response:
{
"id": 134,
"result": 1
}
{
"callback":{},
"id":19,
"method":"callObjectMethod",
"params":[
14,
"items.addObject",
[
"Male",
0
]
]
}
Response:
{
"id": 19,
"result": 14
}
if you want debug something from lazarus you can use the key "debug" like
{
"callback" : {},
"id" : 94,
"method" : "setObjectProperty",
"params" : [
18,
"caption",
"test"
],
"debug" : true
}