Hi, I'd like to send multiple requests, and receive their response respectively.
OPTIONS
DESCRIBE
SETUP
PLAY
In the other issue thread you gave an example how to write one request and grab the response. and it works. I just can't get it to work for multiple transfers. Other than copy&paste the code multiple times, thus opening a new socket for every header send and bloating the code in an ugly manner.
This is what i tried next:
var net = require('net')
var rtsp = require('rtsp-stream')
var encoder = new rtsp.Encoder()
var decoder = new rtsp.Decoder()
// connect to RTSP server
var socket = net.connect({ host: '192.168.178.37', port: 554 }, function () {
// make a request to the RTSP server
var req = encoder.request({ method: 'OPTIONS', uri: '*' })
req.setHeader('CSeq', 1)
req.end()
var req2 = encoder.request({ method: 'DESCRIBE', uri: 'rtsp://192.168.178.37/11' })
req2.setHeader('CSeq', 2)
req2.end()
var req3 = encoder.request({ method: 'SETUP', uri: 'rtsp://192.168.178.37/11/trackID=0' })
req3.setHeader('CSeq', 3)
req3.setHeader('Transport', 'RTP/AVP;unicast;client_port=38936-38937')
req3.end()
})
// handle response from server
decoder.on('response', function (res) {
console.log('--> received response from server:', res.statusCode)
console.log('--> headers:', res.headers)
res.pipe(process.stdout)
})
// connect the plumbing
encoder.pipe(socket).pipe(decoder)
However only the first request is send. I'm not very fond of javascript in general, so i have some problems understanding everything your api does, even if it is fairly small and tidy. Help would be much appreciated.
Hi, I'd like to send multiple requests, and receive their response respectively.
In the other issue thread you gave an example how to write one request and grab the response. and it works. I just can't get it to work for multiple transfers. Other than copy&paste the code multiple times, thus opening a new socket for every header send and bloating the code in an ugly manner.
This is what i tried next:
However only the first request is send. I'm not very fond of javascript in general, so i have some problems understanding everything your api does, even if it is fairly small and tidy. Help would be much appreciated.