Guys There is a web request that i am receiving from
Node : http in
**GET : method **
/msg_stream : PATH ,
URL : http://localhost:1880/msg_stream
When i get request, i need to response with "text/event-stream"
msg.headers['Content-Type'] = 'text/event-stream';
msg.headers['Cache-Control'] = 'no-cache';
msg.headers['Connection'] = 'keep-alive';
msg.headers['Transfer-Encoding'] = 'chunked';
What is the mean of it ?
I need to send responses chunk by chunk to the client. Talking about Step by Step sending responses.
Because of that i need, msg.res.write() function or alternative, but i do not have the necessary function in msg.res-> . so I cant access it.
I can write global functions in settings.js file, BUT I have to pass the Response to the global function, there is only 1 response in msg object, it is msg.res, I think it is coming from express.js . I do not know How can I get access the Response of "msg.res" and cast it to another response type. Because msg.res do not contains neccessary methods that i need.
OR i do not know how to send partially responses.
I need to write 3 writes
res.write("message 1 ")
res.write("message 2 ")
res.write("END")
Please help me, how can i do that. !
msg.res : list of functions .
function : (warn)
object
_res: [internal]
append: function
attachment: function
cookie: function
clearCookie: function
download: function
end: function
format: function
get: function
json: function
jsonp: function
links: function
location: function
redirect: function
render: function
send: function
sendfile: function
sendFile: function
sendStatus: function
set: function
status: function
type: function
vary: function
Another question is that:
How can i get the content of the written function node "http Response" and "http in" , where the source code located ?
may be i can manipulete the code or i can write my own nodes.