TsgcWSPServer_E2EEProperties › Broker

Broker Property

Optional TsgcWSPServer_Broker that lets several server-side subprotocols share a single WebSocket server instead of each subprotocol owning its own Server.

Syntax

property Broker: TsgcWSProtocol_Broker_Server read FBroker write SetBroker;

Default Value

Remarks

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.

Example


oServer := TsgcWebSocketServer.Create(nil);
oBroker := TsgcWSPServer_Broker.Create(nil);
oBroker.Server := oServer;
oProto := TsgcWSPServer_sgc.Create(nil);
oProto.Broker := oBroker;
oServer.Active := True;

Back to Properties