Events are being sent to every client not just the specific client

I’ve got the client / server set up but I’m having an issue. Instead of sending the event to just one specific client it blasts it out to all of the attached clients. The effect is that the clients are receiving multiple events (one for each client).

I should also state that I am trying to have one message sent to multiple stations (basically any station that has the same station name). This software will run on automated truck scale kiosks. I want a company employee to be able to see what the drivers are doing so they’ll have the application on their tablet and they can select which scale kiosk that they want to monitor. When the truck driver presses the ENTER button on the touch screen display I want to send the next prompt from the server to the scale kiosk and the tablet(s) monitoring the driver.

I’ve moved the Login() and Logout() methods to my service and I maintain a static list of Kiosk objects as the devices log in and out.

public bool Login(string Station)
    {
        try
        {
            // 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

                // Create the kiosk (if not already present)
                KioskManager.CreateKiosk(Session.SessionID, Station);

                ServerForm.Instance.RefreshStations();

                SubscribeClientEventSink(typeof(IKioskEventSink));

                Reset();

                return true;
            }
            else
            {
                DestroySession();
                return false;
            }
        }
        catch (Exception ex)
        {
            System.Diagnostics.Trace.WriteLine(ex.ToString());
        }

        return false;
    }

    public void LogOut()
    {
        try
        {
            KioskManager.DropKiosk(Session.SessionID);
        }
        finally
        {
            UnsubscribeClientEventSink(typeof(IKioskEventSink));
            DestroySession();
        }
    }

Here’s the Kiosk object.

    class Kiosk
{
    public Guid ClientId { get; set; }
    public string Name { get; set; }

    public void Reset()
    {
        System.Diagnostics.Trace.WriteLine(string.Format("Resetting {0} ({1})", Name, ClientId));
    }

    public void CompleteStep(string Entry)
    {

    }

    public void Confirmed()
    {

    }

    public void SaveSignature(Image Signature)
    {

    }
}

Here is the method that I’m using to start the numeric keyboard prompt on the kiosk / tablet(s).

    public void NumericKeyboard(string Station, string Caption, string DefaultValue)
    {
        foreach (Kiosk kiosk in KioskManager.Kiosks)
        {
            try
            {
                if (kiosk.Name == Station)
                {
                    IKioskEventSink lEv = (IKioskEventSink)sinkManager.GetEventSink(kiosk.ClientId, typeof(IKioskEventSink));

                    if (lEv != null)
                    {
                        System.Diagnostics.Trace.WriteLine(string.Format("Number keyboard on {0} ({1})", kiosk.Name, kiosk.ClientId));
                        lEv.OnNumberPrompt(Caption, DefaultValue);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.ToString());
            }
        }
    }

I thought that because I am requesting the event sync by it’s client (session) ID that the event would only go to that client but instead it is going to every kiosk / tablet.

Is there something that I’m doing wrong or is this the way it was designed to work?

Hello

1st parameter of the GetEventSink method is id of the sender’.

You need to adjust this code line to

IKioskEventSink lEv = (IKioskEventSink)sinkManager.GetEventSink(Guid.Empty, typeof(IKioskEventSink), new RecipientListEventTargets(new Guid[] { kiosk.ClientId }));

Regards

(I’ll log an issue to provide more descriptive parameter name)

Thanks, logged as bugs://84052

Thank you, sorry that I missed that :slight_smile:

bugs://84052 got closed with status fixed.

bugs://D18775 was closed as fixed.