RobotStudio event

Why is my websocket closing with code 1002?

Options
I've been working with our 2nd Omnicore controller and unfortunately I am having trouble subscribing to resources via the Web API using a websocket connection. The websocket immediately closes with the following code:

"<info>closed Code: 1002 Reason: An exception has occurred while connecting."

This is confusing as we are using the same code and the same setup as with our 1st Omnicore system, where websockets are working ok.

The working system is running RobotControl 7.0.4 whereas the system we are having issues with was originally running 7.2.2, but I upgraded it to 7.3.0 in hopes of fixing the issue. However unfortunately it did not.

Below are the relevant REST interactions with the robot controller:

27/09/2021 13:47:00.089 PM : Session: 1 : POST : https://192.168.3.221:443//subscription : resources=1&1=/rw/panel/ctrl-state&1-p=1 : Starting

27/09/2021 13:47:00.200 PM : Session: 1 : POST : https://192.168.3.221:443//subscription : resources=1&1=/rw/panel/ctrl-state&1-p=1 : Complete

27/09/2021 13:47:00.200 PM : SUBSCRIPTION - Location: wss://192.168.3.221:443/poll/11 groupID: 11 : SUBSCRIPTION

27/09/2021 13:47:00.200 PM : SUBSCRIPTION - Cookies: -http-session-=24::http.session::11b801e5c15740036264713061ee4d76; path=/; domain=192.168.3.221; secure; httponly,ABBCX=2228237; path=/; domain=192.168.3.221; httponly : SUBSCRIPTION

27/09/2021 13:47:00.266 PM : Session: 1 : DELETE : https://192.168.3.221:443//subscription/11//rw/panel/ctrl-state :  : Starting

27/09/2021 13:47:00.271 PM : Session: 1 : DELETE : https://192.168.3.221:443//subscription/11//rw/panel/ctrl-state :  : Complete



For our C# code we are using virtually the same code as what is shown in the ElogSubscriber example provided by ABB. Though we have added this line in the WsConnect method:
"websocket.SslConfiguration.EnabledSslProtocols = SslProtocols.Tls12;"

Does anyone have any ideas as to what is going on here? If you need more information from me please just let me know.

Thanks,
Mike
Tagged:

Answers

  • Kienan123
    Options
    I have had issues with this as well but on the RW6 system I was hopeful it was resolved on the RW7.

    Have not got much support by ABB on this topic so I have not fully resolved this issue any updates on your issues would be appreciated. 

    The exsample code on the developer center is extremely out of date. 

    If the system connects correctly the first time (no cookie or session information stored) it wont have an issue. What can happen is the cookie ABBCX=2228237 is not actually the right cookie, it gets replaced on the very next communication response. A value of 2228237 means that the controller has been sending a lot of new cookies. This can result in zombie's users on the controller when its not closing them correctly, eventually maxing the controller out resulting in an error with every new ABBCX. This can be seen on the rws_info_show.txt in the system diagnostics. 

    Most of my programs are using java script but the concept is the same. 

    1. First contact
      1. Server responds with session: -http-session-
    2. Subsequent requests provide cookie: -http-session-
      1. Server responds with cookie: ABBCX
      2. Update cookie jar do not replace
    3. Subsequent requests Provide cookie: -http-session-, ABBCX

    In all responses look for update cookie. Do not overwrite only update needed cookie -http-session- or ABBCX never both. If both are provided update Session then on the next communication update the new ABBCX

    if 'Set-Cookie' in res.headers:

    self.session.cookies.update(resp.cookies)

    I still have issues with subscription but if your send a few GET request and get a stable -http-session-and  ABBCX locked in before subscribing has kind of worked for me

    Its also best to not have Robot Studio active when your program is first connecting.


  • MikeTT
    Options
    Hi Kienan, thanks for the response, I'm struggling to find time to test this at the moment but once I get round to it I'll let you know how I get on!