marcus-nystrom / Titta

Python and PsychoPy interface to Tobii eye trackers using Tobii Pro SDK
Other
71 stars 27 forks source link

External Presenter Error: Exclusive connection to service already established. Only one allowed at a time. Please disconnect #32

Closed ShubhamKaushal15 closed 1 year ago

ShubhamKaushal15 commented 1 year ago

Hi, I'm unfamiliar with websocket protocols so I'm not sure whom to ask about this problem I'm facing. ttl.get_state() in read_me_TalkToProLab.py gives me an error which I'm able to reproduce using the code below. Does anyone have any idea why this might be happening?

>>> from websocket import create_connection
>>> import json
>>> address = create_connection('ws://localhost:8080/record/externalpresenter?client_id=RemoteClient')
>>> req = {"operation": "GetState"}
>>> msg_dict = json.dumps(req)      
>>> address.send(msg_dict)
31
>>> address.recv()
'{"reason":"Exclusive connection to service already established. Only one allowed at a time. Please disconnect.","status_code":104,"operation":"GetState"}'

Also, if someone could give me an intuition as to how these websocket links are obtained, that would be very helpful. I found that a connection to the link above is not made when Tobii Pro Lab is not running, but I was unable to find websocket links mentioned anywhere in their documentation. Thank you so much for your help in advance!

marcus-nystrom commented 1 year ago

Hi @ShubhamKaushal15,

Looks like you're already have an active connection when trying to connect to Pro Lab. Close the initial connection first and try again. Have updated the instruction in the read_me_TalkToProLab.py-file.

"Also, if someone could give me an intuition as to how these websocket links are obtained, that would be very helpful." Not sure I understand what you mean.

Make sure the external presenter is disconnected (External presenter button in Tobii pro lab is red) before running the code.