I'm working under one cloud solution, that's allow user to print receipts on ESC/POS printer. So it's actually pretty easy to print on it like
echo "Hello world!" | nc 192.168.1.37 9100
But, I need to do the same with from user's browser. So i've tried like this:
var connection = new WebSocket('ws://IPAddress:Port');
connection.onopen = function () {
connection.send('Ping'); // Send the message 'Ping' to the server
};
And almost done, but WS send whole stack of HTTP headers starts with
GET / HTTP/1.1
...
Is there way to send it without headers? Or other way to send data to printer?