thanks a lot...
I have solved it just by lua concatation.
suppose that my data type and data content are:
local dataType = x -- string data
local dataContent=y --binary bytearray data
so just we will try to send the data like this:
local sock = ngx.socket.tcp()
local ok, err = sock:connect("x.x.x.x","100")
if not ok then
ngx.log(ngx.ERR,"Failed to connect to minifier socket!")
return
end
local bytes, err = sock:send(dataType.. dataContent)
sock:settimeout(10000)
then we can receive it fron node and then we can retrieve both data (type and content) like:
var Buffer = require('buffer').Buffer;
var buf = new Buffer(data); // dataType.. dataContent
var datatype = buf.slice(0, 3).toString();
var dataContent = buf.slice(3, data.length);