Thank for responding.
Assume that client is android.
I can reading voice data from device, and sent to nodejs server.
nodejs server use datagram library to receive voice data which is sent from device.
Now, i can't find solution to send received voice data to all connected clients.
///////////////////////////////////////////////////////////////////////////////////////////
var http = require('http'),
dgram = require('dgram'),
var app = http.createServer(handleRequest),
io = socketio.listen(app),
socket = dgram.createSocket('udp4');
socket.on('message', function(content, rinfo) {
console.log('got message', content, 'from', rinfo.address, 'port ',rinfo.port);
io.sockets.emit('udp_message', 'test',rinfo.port);
socket.send(content, 0, content.length, 50006, rinfo.address, function(err, bytes) {
//socket.close();
});
});
function handleRequest(req, res) {
res.writeHead(200, {'content-type': 'text/html'});
res.end("<!doctype html> \
<html><head> \
<script> \
var socket = io.connect('localhost', {port: 8000}); \
socket.on('udp message', function(message) { console.log(message) }); \
</script></head></html>");
}
socket.bind(50005);
app.listen(8000);
///////////////////////////////////////////////////////////////////////////////////////////
I am waiting for your respons.