Why the Event not working

I was learning how to use multicast event in RO

i create a demo , but it seems not working well.

I call the event in ServerForm:
procedure TServerForm.Button1Click(Sender: TObject);
var
ev: IMulticastTestEvent_Writer;
begin
ev := (ROInMemoryEventRepository1 as IMulticastTestEvent_Writer);
ev.ExcludeSender := False;
ev.NoticeUser(EmptyGUID);
end;

After the client connect to server, i click the button1, the event seems not working.

If i call the Sum function and trigger the event, which at MulticastService_Impl.pas, the Event in Button1 send to client, and it works well.
if i comment the event in the Sum function, the Event in Button1 never send to client.

Do i forggot to set something? The attachment is the demo.

MulticastProject.zip (114.6 KB)

I can manully AddSession for the session, to make it works, the AutoRegisterSession not woks?

But question again.
I wanna to addsession in ROServerClientConnected, is that posible? How can i get the Session.SessionID in ROServerClientConnected

I have checked the AutoRegisterSession for RoSuperTcpServer , why do i still have to addsession by myself?

AutoRegisterSession (declared in TROBaseSuperTCPServer)

This property is used by the server to automatically sign new clients up to the event repository, to make it possible fo them to receive events without manual registration.

property AutoRegisterSession: Boolean read write

:sweat: why it not works…

I’ve updated your project and now it works: MulticastProject.zip (114.2 KB)

Note: by security reasons, session isn’t create automatically so you need to create it manually with CreateSession
Also you have used wrong SessionManager: TROEventSessionManager. in this session manager, you have to manually implement events otherwise it won’t be functional. see above link for more details.

1 Like

:grinning:

Really thanks for your help