Code: Select all
sendMessage(method, params?, isNotification := false) {
static _id := 0
if !isNotification
id := ++_id & 0xffffffff
str := JSON.stringify({
jsonrpc: '2.0',
id: id?,
method: method,
params: params?
})
str := 'Content-Length:' (StrPut(str, 'utf-8') - 1) '`r`n`r`n' str
client.SendText(str)
return client.RecvText()
}