Once client has connected to server, server can send binary messages. To send a Binary Message, just call WriteData() method to send a message to a single client or use Broadcast to send a message to all clients.
Call To WriteData() method and send a Binary message.
TsgcWebSocketServer1.WriteData('guid', TMemoryStream.Create);
If QueueOptions.Binary has a different value from qmNone, instead of be processed on the same thread that is called, it will be processed on a secondary thread. By default this option is disabled.
QueueOptions doesn't work if the property IOHandlerOptions.IOHandlerType = iohIOCP (due to the IOCP architecture, this feature is not supported).
You can call to WriteData() method from TsgcWSConnection too, example: send a message to client when connects to server.
procedure OnConnect(Connection: TsgcWSConnection);
begin
Connection.WriteData(TMemoryStream.Create);
end;
Call To Broadcast() method to send a Binary message to all connected clients.
TsgcWebSocketServer1.Broadcast(TMemoryStream.Create);