unit ChannelID;
interface
uses
  System.SysUtils, DataSnap.DSClientRest, Data.DBXJSON, DataSnap.DSHTTPCommon;

const
  ChannelName = 'MyCallbackChannelName';

procedure ChannelBroadCast(AChannel: TDSRestClientChannel); overload;
procedure ChannelBroadCast(AChannel: TDSClientCallbackChannelManager); overload;

implementation

procedure ChannelBroadCast(AChannel: TDSRestClientChannel);
var
  LMessage: TJSONString;
begin
  if AChannel <> nil then
  begin
    LMessage := TJSONString.Create(Format('%s %s',
      [AChannel.ServerChannelName, AChannel.ChannelId]));
    try
      AChannel.Broadcast(LMessage);
    finally
      LMessage.Free;
    end;
  end;
end;

procedure ChannelBroadCast(AChannel: TDSClientCallbackChannelManager);
var
  LMessage: TJSONString;
begin
  if AChannel <> nil then
  begin
    LMessage := TJSONString.Create(Format('%s %s',
      [AChannel.ChannelName, AChannel.ManagerId]));
    try
      AChannel.BroadcastToChannel(LMessage)
    finally
    //LMessage.Free
    end
  end
end;

end.
