Hello,
Using the chat example as a reference I have managed to set up a client and a server with events. I can send events from the server’s service implementation.
What I would like to be able to do is to have a text edit and a button on my main form. When the user clicks the button on the main form then I want to send a message to a specific client. I’ve tried the code below but I’m guessing that this sends a message to every attached client, correct?
IKioskEventSink lEv = (IKioskEventSink)sinkManager.GetEventSink(Guid.Empty, typeof(IKioskEventSink));
if (lEv != null)
lEv.OnMenu(Items);
How do I get the client id of the clients?
In my service I do have a Login and Logout method that creates an object and stores it into a list<> of objects. Is this where I would capture the client id and save it to the newly created object?
public bool Login(string Station)
{
// provide proper logic to validate the user’s credentials
bool loginValid = !string.IsNullOrEmpty(Station);
if (loginValid)
{
// perform additional setup for the user's session, if needed
Session["Station"] = Station; // create a session
KioskManager.GetKiosk(Station);
SubscribeClientEventSink(typeof(IKioskEventSink));
try
{
Reset();
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine(ex.ToString());
}
return true;
}
else
{
DestroySession();
return false;
}
}
public void LogOut()
{
UnsubscribeClientEventSink(typeof(IKioskEventSink));
DestroySession();
}