I am using socket.io and the dgram node library to send UDP messages from one program to the browser via node.
The code looks just like socket.io example
var dgram = require("dgram"); var dServer = dgram.createSocket("udp4"); dServer.bind(12345, '0.0.0.0'); var io = require('socket.io').listen(80); io.sockets.on('connection', function (socket) { dServer.on("message", function (msg) { socket.send('message', msg); }); });
Question: at what speed are datagrams sent to the browser? They are sent at TCP speed, web socket speed (which I understand more slowly) or UDP speed (which I understand faster when it comes to real-time transmission).
Also, in this example, io is constantly listening on port 80 (which means that it can only receive data at HTTP / tcp speeds) or it just listens for a socket connection and then can stop listening (and allow the socket connection more)
source share