Consider this basic socket.io code.
Client:
function chat(message) {
socket.emit('c2s', message);
}
socket.on('s2c', (message) => {
console.log(message);
});
Server:
socket.on('c2s', (message) => {
io.emit('s2c', message);
});
There is no form of validation here, and there is nothing stopping the client from sending data to the server via inspect element. How do I go about validating the incomming data on the server side, such that anything sent manually by the user is highly unlikely to be valid?