TsgcWSPServer_Dataset › Properties › Broker
Optional TsgcWSPServer_Broker that lets several server-side subprotocols share a single WebSocket server instead of each subprotocol owning its own Server.
property Broker: TsgcWSProtocol_Broker_Server read FBroker write SetBroker;
—
Assign a TsgcWSPServer_Broker when the server needs to host more than one subprotocol on the same TsgcWebSocketServer (for example sgc + Files, or MQTT + Presence). The broker holds the Server reference; every subprotocol server component then attaches to the broker via its own Broker property. Server and Broker are mutually exclusive.
oServer := TsgcWebSocketServer.Create(nil);
oBroker := TsgcWSPServer_Broker.Create(nil);
oBroker.Server := oServer;
oProto := TsgcWSPServer_sgc.Create(nil);
oProto.Broker := oBroker;
oServer.Active := True;