Be notified in real-time on any activity (for instance connection, cursor move, typing...) #3

Open
opened 2024-03-01 17:34:56 +01:00 by Benjamin_Loison · 19 comments

This would enable us to backup Overleaf content without regular git pull, see OC3K crontab.

Related to #11, Overleaf_history_exporter and Improve_websites_thanks_to_open_source/issues/770.

+20

This would enable us to backup Overleaf content without regular `git pull`, see OC3K `crontab`. Related to #11, [Overleaf_history_exporter](https://codeberg.org/Benjamin_Loison/Overleaf_history_exporter) and [Improve_websites_thanks_to_open_source/issues/770](https://codeberg.org/Benjamin_Loison/Improve_websites_thanks_to_open_source/issues/770). +20
Benjamin_Loison changed title from Be notified in real-time on any activity (for instance cursor move, typing...) to Be notified in real-time on any activity (for instance connection, cursor move, typing...) 2024-03-01 20:44:07 +01:00
Author
Owner

DuckDuckGo and Google search Overleaf WebSocket.

DuckDuckGo and Google search *Overleaf WebSocket*.
Author
Owner

Most results seem about hosting our own instance.

https://www.overleaf.com/socket.io/1/websocket/

XXXXXXXXXXXXXXXXXXXX:60:60:websocket,flashsocket,htmlfile,xhr-polling,jsonp-polling

first part changes everytime. Same for https://www.overleaf.com/socket.io/1/ and https://www.overleaf.com/socket.io/1/uzgxahft/ uzgxahft being a random string I generated.

There is no further request on Firefox when loading this webpage.

Most results seem about hosting our own instance. https://www.overleaf.com/socket.io/1/websocket/ ``` XXXXXXXXXXXXXXXXXXXX:60:60:websocket,flashsocket,htmlfile,xhr-polling,jsonp-polling ``` first part changes everytime. Same for https://www.overleaf.com/socket.io/1/ and https://www.overleaf.com/socket.io/1/uzgxahft/ `uzgxahft` being a random string I generated. There is no further request on Firefox when loading this webpage.
Author
Owner

Should investigate these keywords. Well these seem to be old technologies except websocket.

Should investigate these keywords. Well these seem to be old technologies except `websocket`.
Author
Owner

Let us read Wikipedia: WebSocket (1265617417). I quite completely read it.

Let us read [Wikipedia: WebSocket (1265617417)](https://en.wikipedia.org/w/index.php?title=WebSocket&oldid=1265617417). I quite completely read it.
Author
Owner
Related to [Benjamin-Loison/Contracts-management-website/issues/1](https://github.com/Benjamin-Loison/Contracts-management-website/issues/1).
Author
Owner
curl -I https://www.overleaf.com/socket.io/1/websocket/
Output:
HTTP/2 200 
content-type: text/plain
date: Sun, 02 Mar 2025 23:30:05 GMT
via: 1.1 google
set-cookie: GCLB=XXXXXXXXXXXXXXXX; path=/; HttpOnly
alt-svc: clear

```bash curl -I https://www.overleaf.com/socket.io/1/websocket/ ``` <details> <summary>Output:</summary> ``` HTTP/2 200 content-type: text/plain date: Sun, 02 Mar 2025 23:30:05 GMT via: 1.1 google set-cookie: GCLB=XXXXXXXXXXXXXXXX; path=/; HttpOnly alt-svc: clear ``` </details>
Author
Owner

DuckDuckGo search "Protocol "wss" not supported or disabled in libcurl".

The Stack Overflow answer 47861907:

Shell:
benjamin_loison@Benjamin-Loison-HP-Debian:~$ wscat -c "wss://ws-feed.gdax.com"
error: Unexpected server response: 526
> benjamin_loison@Benjamin-Loison-HP-Debian:~$
Shell:
benjamin_loison@Benjamin-Loison-HP-Debian:~$ wscat -c 'wss://www.overleaf.com/socket.io/1/websocket/'
error: Unexpected server response: 502
> benjamin_loison@Benjamin-Loison-HP-Debian:~$
Shell:
benjamin_loison@Benjamin-Loison-HP-Debian:~$ wscat -c 'wss://www.overleaf.com/socket.io/1/websocket/'
Connected (press CTRL+C to quit)
< 7:::1+0
Disconnected (code: 1006, reason: "")
DuckDuckGo search `"Protocol "wss" not supported or disabled in libcurl"`. [The Stack Overflow answer 47861907](https://stackoverflow.com/a/47861907): <details> <summary>Shell:</summary> ``` benjamin_loison@Benjamin-Loison-HP-Debian:~$ wscat -c "wss://ws-feed.gdax.com" error: Unexpected server response: 526 > benjamin_loison@Benjamin-Loison-HP-Debian:~$ ``` </details> <details> <summary>Shell:</summary> ``` benjamin_loison@Benjamin-Loison-HP-Debian:~$ wscat -c 'wss://www.overleaf.com/socket.io/1/websocket/' error: Unexpected server response: 502 > benjamin_loison@Benjamin-Loison-HP-Debian:~$ ``` </details> <details> <summary>Shell:</summary> ``` benjamin_loison@Benjamin-Loison-HP-Debian:~$ wscat -c 'wss://www.overleaf.com/socket.io/1/websocket/' Connected (press CTRL+C to quit) < 7:::1+0 Disconnected (code: 1006, reason: "") ``` </details>
Author
Owner
Shell:
benjamin_loison@Benjamin-Loison-HP-Debian:~$ wscat -c 'wss://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=XXXXXXXXXXXXXXXXXXXXXXXX'
error: Unexpected server response: 502
> benjamin_loison@Benjamin-Loison-HP-Debian:~$
Shell:
benjamin_loison@Benjamin-Loison-HP-Debian:~$  wscat -c 'wss://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=XXXXXXXXXXXXXXXXXXXXXXXX'
Connected (press CTRL+C to quit)
Disconnected (code: 1006, reason: "")
<details> <summary>Shell:</summary> ``` benjamin_loison@Benjamin-Loison-HP-Debian:~$ wscat -c 'wss://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=XXXXXXXXXXXXXXXXXXXXXXXX' error: Unexpected server response: 502 > benjamin_loison@Benjamin-Loison-HP-Debian:~$ ``` </details> <details> <summary>Shell:</summary> ``` benjamin_loison@Benjamin-Loison-HP-Debian:~$ wscat -c 'wss://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=XXXXXXXXXXXXXXXXXXXXXXXX' Connected (press CTRL+C to quit) Disconnected (code: 1006, reason: "") ``` </details>
Author
Owner
Bash script:
 curl 'wss://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=YYYYYYYYYYYYYYYYYYYYYYYY' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Sec-WebSocket-Version: 13' -H 'Origin: https://www.overleaf.com' -H 'Sec-WebSocket-Extensions: permessage-deflate' -H 'Sec-WebSocket-Key: ZZZZZZZZZZZZZZZZZZZZZZZZ' -H 'Connection: keep-alive, Upgrade' -H 'Cookie: oa=0; overleaf_session2=s%3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB%2BCCCCCC; GCLB=DDDDDDDDDDDDDDDD' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: websocket' -H 'Sec-Fetch-Site: same-origin' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'Upgrade: websocket'
curl: (1) Protocol "wss" not supported or disabled in libcurl
<details> <summary>Bash script:</summary> ```bash curl 'wss://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=YYYYYYYYYYYYYYYYYYYYYYYY' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br, zstd' -H 'Sec-WebSocket-Version: 13' -H 'Origin: https://www.overleaf.com' -H 'Sec-WebSocket-Extensions: permessage-deflate' -H 'Sec-WebSocket-Key: ZZZZZZZZZZZZZZZZZZZZZZZZ' -H 'Connection: keep-alive, Upgrade' -H 'Cookie: oa=0; overleaf_session2=s%3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB%2BCCCCCC; GCLB=DDDDDDDDDDDDDDDD' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: websocket' -H 'Sec-Fetch-Site: same-origin' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'Upgrade: websocket' ``` </details> ``` curl: (1) Protocol "wss" not supported or disabled in libcurl ```
Author
Owner

https://socket.io

socket.io

About

Realtime application framework (Node.JS server)

so it won't help much it seems.

https://socket.io/docs/v4/client-api/ may help.

https://socket.io [socket.io](https://github.com/socketio/socket.io) > About > Realtime application framework (Node.JS server) so it won't help much it seems. https://socket.io/docs/v4/client-api/ may help.
Author
Owner
 wscat -c 'wss://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=XXXXXXXXXXXXXXXXXXXXXXXX'
Output:
Connected (press CTRL+C to quit)
< 7:::1+0
Disconnected (code: 1006, reason: "")
```bash wscat -c 'wss://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=XXXXXXXXXXXXXXXXXXXXXXXX' ``` <details> <summary>Output:</summary> ``` Connected (press CTRL+C to quit) < 7:::1+0 Disconnected (code: 1006, reason: "") ``` </details>
Author
Owner

DuckDuckGo search socket.io Python client.

DuckDuckGo search *socket.io Python client*.
Author
Owner

https://pypi.org/project/python-socketio/
python-socketio has 4.1 k stars and last commit was 3 days ago.

https://pypi.org/project/python-socketio/ [python-socketio](https://github.com/miguelgrinberg/python-socketio) has 4.1 k stars and last commit was 3 days ago.
Author
Owner

The Socket.IO protocol has been through a number of revisions, and some of these introduced backward incompatible changes, which means that the client and the server must use compatible versions for everything to work.

Source: python-socketio/blob/781dc9a0305f6a795a0467ebc795f4b765084a0d/README.md#version-compatibility

> The Socket.IO protocol has been through a number of revisions, and some of these introduced backward incompatible changes, which means that the client and the server must use compatible versions for everything to work. Source: [python-socketio/blob/781dc9a0305f6a795a0467ebc795f4b765084a0d/README.md#version-compatibility](https://github.com/miguelgrinberg/python-socketio/blob/781dc9a0305f6a795a0467ebc795f4b765084a0d/README.md#version-compatibility)
Author
Owner
https://python-socketio.readthedocs.io/en/stable/client.html
Author
Owner
pip install "python-socketio[client]"
Output:
Requirement already satisfied: python-socketio[client] in ./venv/lib/python3.11/site-packages (5.11.3)
Requirement already satisfied: bidict>=0.21.0 in ./venv/lib/python3.11/site-packages (from python-socketio[client]) (0.23.1)
Requirement already satisfied: python-engineio>=4.8.0 in ./venv/lib/python3.11/site-packages (from python-socketio[client]) (4.11.2)
Requirement already satisfied: requests>=2.21.0 in ./venv/lib/python3.11/site-packages (from python-socketio[client]) (2.32.3)
Requirement already satisfied: websocket-client>=0.54.0 in ./venv/lib/python3.11/site-packages (from python-socketio[client]) (1.8.0)
Requirement already satisfied: simple-websocket>=0.10.0 in ./venv/lib/python3.11/site-packages (from python-engineio>=4.8.0->python-socketio[client]) (1.1.0)
Requirement already satisfied: charset-normalizer<4,>=2 in ./venv/lib/python3.11/site-packages (from requests>=2.21.0->python-socketio[client]) (3.4.1)
Requirement already satisfied: idna<4,>=2.5 in ./venv/lib/python3.11/site-packages (from requests>=2.21.0->python-socketio[client]) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in ./venv/lib/python3.11/site-packages (from requests>=2.21.0->python-socketio[client]) (2.3.0)
Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.11/site-packages (from requests>=2.21.0->python-socketio[client]) (2025.1.31)
Requirement already satisfied: wsproto in ./venv/lib/python3.11/site-packages (from simple-websocket>=0.10.0->python-engineio>=4.8.0->python-socketio[client]) (1.2.0)
Requirement already satisfied: h11<1,>=0.9.0 in ./venv/lib/python3.11/site-packages (from wsproto->simple-websocket>=0.10.0->python-engineio>=4.8.0->python-socketio[client]) (0.14.0)
```bash pip install "python-socketio[client]" ``` <details> <summary>Output:</summary> ``` Requirement already satisfied: python-socketio[client] in ./venv/lib/python3.11/site-packages (5.11.3) Requirement already satisfied: bidict>=0.21.0 in ./venv/lib/python3.11/site-packages (from python-socketio[client]) (0.23.1) Requirement already satisfied: python-engineio>=4.8.0 in ./venv/lib/python3.11/site-packages (from python-socketio[client]) (4.11.2) Requirement already satisfied: requests>=2.21.0 in ./venv/lib/python3.11/site-packages (from python-socketio[client]) (2.32.3) Requirement already satisfied: websocket-client>=0.54.0 in ./venv/lib/python3.11/site-packages (from python-socketio[client]) (1.8.0) Requirement already satisfied: simple-websocket>=0.10.0 in ./venv/lib/python3.11/site-packages (from python-engineio>=4.8.0->python-socketio[client]) (1.1.0) Requirement already satisfied: charset-normalizer<4,>=2 in ./venv/lib/python3.11/site-packages (from requests>=2.21.0->python-socketio[client]) (3.4.1) Requirement already satisfied: idna<4,>=2.5 in ./venv/lib/python3.11/site-packages (from requests>=2.21.0->python-socketio[client]) (3.10) Requirement already satisfied: urllib3<3,>=1.21.1 in ./venv/lib/python3.11/site-packages (from requests>=2.21.0->python-socketio[client]) (2.3.0) Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.11/site-packages (from requests>=2.21.0->python-socketio[client]) (2025.1.31) Requirement already satisfied: wsproto in ./venv/lib/python3.11/site-packages (from simple-websocket>=0.10.0->python-engineio>=4.8.0->python-socketio[client]) (1.2.0) Requirement already satisfied: h11<1,>=0.9.0 in ./venv/lib/python3.11/site-packages (from wsproto->simple-websocket>=0.10.0->python-engineio>=4.8.0->python-socketio[client]) (0.14.0) ``` </details>
Author
Owner
Python script:
import socketio

# standard Python
with socketio.SimpleClient() as sio:
    # ... connect to a server and use the client
    # ... no need to manually disconnect!
    sio.connect('https://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=XXXXXXXXXXXXXXXXXXXXXXXX', transports = ['websocket'])
    event = sio.receive()
    print(f'received event: "{event[0]}" with arguments {event[1:]}')
Output:
Traceback (most recent call last):
  File "<tmp 3>", line 7, in <module>
    sio.connect('wss://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=XXXXXXXXXXXXXXXXXXXXXXXX', transports = ['websocket'])
  File "/home/benjamin_loison/venv/lib/python3.11/site-packages/socketio/simple_client.py", line 82, in connect
    self.client.connect(url, headers=headers, auth=auth,
  File "/home/benjamin_loison/venv/lib/python3.11/site-packages/socketio/client.py", line 159, in connect
    raise exceptions.ConnectionError(exc.args[0]) from None
socketio.exceptions.ConnectionError: Connection error

same if use https://.

<details> <summary>Python script:</summary> ```python import socketio # standard Python with socketio.SimpleClient() as sio: # ... connect to a server and use the client # ... no need to manually disconnect! sio.connect('https://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=XXXXXXXXXXXXXXXXXXXXXXXX', transports = ['websocket']) event = sio.receive() print(f'received event: "{event[0]}" with arguments {event[1:]}') ``` </details> <details> <summary>Output:</summary> ``` Traceback (most recent call last): File "<tmp 3>", line 7, in <module> sio.connect('wss://www.overleaf.com/socket.io/1/websocket/XXXXXXXXXXXXXXXXXXXX?projectId=XXXXXXXXXXXXXXXXXXXXXXXX', transports = ['websocket']) File "/home/benjamin_loison/venv/lib/python3.11/site-packages/socketio/simple_client.py", line 82, in connect self.client.connect(url, headers=headers, auth=auth, File "/home/benjamin_loison/venv/lib/python3.11/site-packages/socketio/client.py", line 159, in connect raise exceptions.ConnectionError(exc.args[0]) from None socketio.exceptions.ConnectionError: Connection error ``` </details> same if use `https://`.
Author
Owner

DuckDuckGo and Google search Python Overleaf client.

pyoverleaf does not seem helpful.

DuckDuckGo and Google search *Python Overleaf client*. [pyoverleaf](https://github.com/jkulhanek/pyoverleaf) does not seem helpful.
Author
Owner

https://www.overleaf.com/socket.io/

Welcome to socket.io.

https://www.overleaf.com/socket.io/ *Welcome to socket.io.*
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Benjamin_Loison/overleaf#3
No description provided.