How to add/manage clients in SSE??
imshoaibIsmail opened this issue · 5 comments
i am implementing this SSE. i was wondering how to add the clients to group? and then sent/publish message to those clients
Hi @imshoaibIsmail,
You should be able to find the information you are looking for here: https://tpeczek.github.io/Lib.AspNetCore.ServerSentEvents/articles/groups.html
Hello tpeczek
thanks for your help appreciated!!
can you please explain me how to create a client and then pass it to the
_serverSentEventsService.AddToGroup(groupName, client);
for adding a new client to a group....
i am facing difficulty in client creation or may be i am confused
You shouldn't be creating a client, it's done by the library.
As the first sample in mentioned documentation shows, it's already part of the context (clientConnectedArgs.Client
).
my scenario is something like when a user want to subscribe for updates of stocks for a particular symbol...
i will create a group by the name of symbol... and i will create client for that user and will add that client in that group.. and will send updates to that particular group..
can you help me in this... ??? may be i am in wrong direction
So now we are going beyond "how to add the clients to group" 😊.
In what you describe, the important aspect is architecture and flow of the whole thing. The client
in context of Server-Sent Events represents a single active connection, so following questions needs to be answered:
- How are users identified?
- How many active connections can user have (one per group, one for all groups)?
- Are the subscriptions persistent, or only in scope of current session?
- How the action of creating a subscription relates to establishing a connection?