Let me tell you a little about what I'm trying to accomplish.
I have a device (chip and pin terminal) that has a local IP address, it is programmed to receive certain data and process it.
example: I send the string "05" in hexadecimal "30 35" , and the terminal reads this and reboots.
I tried using SockJS-Client as well as the built-in WebSockets .
However, using Websockets, I notice that the browser sends:
GET / HTTP/1.1 Host: IP:PORT Connection: Upgrade Pragma: no-cache Cache-Control: no-cache Upgrade: websocket Origin: MYIP Sec-WebSocket-Version: 13 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36 Accept-Encoding: gzip, deflate, sdch Accept-Language: en-US,en;q=0.8 Sec-WebSocket-Key: A1CeTMFnQCZv4GNZbLFnyQ== Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
When my code looks like this:
var exampleSocket = new WebSocket("ws://IP:PORT"); exampleSocket.send("05");
If I change the code to this:
var exampleSocket = new WebSocket("wss://IP:PORT"); exampleSocket.send("05");
I just get 3 tags that are sent: SYN(0x0016) ETX(0x0003) SOH(0x0001)
Now I'm not sure what you need for WebSocket Sever to interpret incoming data.
SockJS does the same, sending additional information about itself and the bracelet:
GET /info?t=1452272641278 HTTP/1.1 Host: IP:PORT Connection: keep-alive User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36 Origin: MYIP Accept: */* Referer: MYIP Accept-Encoding: gzip, deflate, sdch Accept-Language: en-US,en;q=0.8
So, I think, my question. Is there a way to send exactly what I want? without any additional data?
I completed this in Objective-C as well as C #, I'm just not sure if javascript can do this?
Please ask if something is not clear, and I will try to clarify.