Send WebSocket Binary Messages with an ID

When a client sends a binary message to server, sometimes is useful set an ID to identify binary message when is received. There are 2 functions in sgcWebSocket_Helpers which can be used to set a short description of binary packet, basically adds a header to stream which is used to identify binary packet.


Before send a binary message, call sgcWSStreamWrite method to encode stream.

   vID := '00001';

   sgcWSStreamWrite(vID, oStream);



When binary message is received, call sgcWSStreamRead method to decode stream.

   sgcWSStreamRead(oStream, vID);


The only limitation is that text used to identify binary message, has a maximum length of 10 characters (this can be modified if you have access to source code).