Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Detecting if a client is connected to webvisu server

RodneyC
2016-06-28
2023-11-08
  • RodneyC - 2016-06-28

    Is there a way to detect that a client is connected and is able to communicate with webvisu? My concern is that a user loses connection over wifi and is not able to stop the plc remotely. Ideally I would like to have a variable that could be used to enable a safety latch.

     
  • RodneyC - 2016-08-04

    Hello,

    Still looking for a solution to this. If anyone has any advice it would be most welcome!

    Google is giving me nothing, at least not with the search terms I'm coming up with.

     
  • RodneyC - 2016-08-13

    maybe I'm starting to get somewhere.

    I can see that when I watch the auto logout timer, the time will start ticking down from 50 days one the first client login (webvisu loaded into browser) and stops when I disconnect the client from wifi. Is there a variable that will simply allow me to tell if the webvisu client is connected? Is there a timeout flag of srts that can be seen when I close my wifi connection on the client end?

     
  • RodneyC - 2016-09-18

    I keep forgetting to update this thread.

    I never did find a status bit of sorts or even a variable with number of clients connected, etc. I wasn't even able to use the client type function, since they returned nothing or ??. I did however use the auto-logoff countdown timer to determine when a client was present and used it to control a safety latch when the user is toggled into a certain run mode.

    If there is a simpler way to just see if a client is there or not, via a BOOL or other variable, (eg: number_of_clients = 0) please let me know.

     
  • LyngaaNSN - 2017-11-14

    Hello

    I am doing the same thing, do you know what happens when the autologout runs out?

     
  • dgirard - 2019-02-21

    Here's the workaround that I've been able to accomplish:

    For my application, I am only looking to see if there is a client using Webvisu or not, I am not so much concerned with how many Webvisu clients there are at any given time. I can keep count of the number of clients using Webvisu with the following:

    Declaration:

    pClient       :    POINTER TO VisuElems.VisuElemBase.VisuStructClientData;
    ClientCount : INT := 0;
    NoClients: BOOL; //True if there are no webvisu clients
    

    Program:

    VisuElems.g_ClientManager.BeginIteration();
    ClientCount:=0; 
    WHILE (pClient := VisuElems.VisuElemBase.g_ClientManager.GetNextClient()) <> 0 DO
        IF pClient^.GlobalData.ClientType = VisuElems.VisuElemBase.Visu_ClientType.WebVisualization THEN
          ClientCount:= ClientCount+1;
        END_IF
    END_WHILE
    IF ClientCount =0 THEN
       NoClients := TRUE;
    ELSE
       NoClients := FALSE;
    END_IF
    

    The inspiration came from the following link on the FAQ page: https://faq.codesys.com/display/CDSFAQ/WebVisu%3A+Reading+the+IP+Address+of+the+Client

    Hope this helps!

     
  • imdatatas - 2023-11-08

    Thank you @dgirard
    Your idea and above description helped me what i was looking for.

     

Log in to post a comment.