Once the client has connected to the server, the server can send binary messages. To send a Binary Message, call the WriteData() method to send a message to a single client, or use Broadcast to send a message to all clients.
Call the WriteData() method to send a binary message.
TsgcWebSocketServer1.WriteData('guid', TMemoryStream.Create);
If QueueOptions.Binary has a different value from qmNone, instead of being 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 also call the 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 the Broadcast() method to send a binary message to all connected clients.
TsgcWebSocketServer1.Broadcast(TMemoryStream.Create);