Sorry
Either they don't understand me or I don't understand them.
I have a controller that runs a server that supports websocket.
This server supports websocket communication as a byte array.
Now I would like to set up a connection to this server via TMS WebSocketClient and exchange the data via byte array.
As far as I know, this means that I can read and write byte arrays with the TMS WebSocketClient.
I cannot establish communication with this server on the controller with a second server.
I call up the IP address via Firefox (192.168.200.66:30000) then
the index.html and the Web.js file are uploaded from the Server.
Then a WebSocket connection to the server is opened with the WebSocketClient component:
WebSocketClient1.HostName: = HostIPAddr;
WebSocketClient1.Port: = StrToInt (HostPort);
WebSocketClient1.Connect;
everything works and i can read and send strings and here comes the problem:
In your web socket client implementation you can only send and read strings:
WebSocketClient1DataReceived
jo := SocketData.JSObject;
Str := jo.toString;
WebSocketClient1.Send (string); // s = string
and I would need a byte function for communication with the websocket server:
WebSocketClient1DataReceived
jo := SocketData.JSObject;
byteArray := jo.toByteArray; or something like that
WebSocketClient1.Send_binary (bytearray); or something like that
I have no idea how to solve it any other way.
Especially not how I should solve this with a WebSocketServer.
Here is another example to illustrate:
websocket ws = websocket.WebSocket ()
ws.connect ("ws: // xxxxxxxxxxx")
ws.send_binary ([100, 220, 130]) send buffer à byte 1 = 100 / byte 2 = 220 / byte 3 = 130 to web socket server
ws.send ("Hello world") send buffer à byte = 72 / byte 2 = 101 / byte 3 = 108 ... etc. to websocket server
ws.close ()
Since the byte data also contain byte = 00 or 01 or 245 or 255 etc. I cannot send them as a string.
I tried to simply copy the byte array into the string, but that doesn't work because the string is interpreted.