Unknown cursor marker sometimes shown in the editor

Hi, in the code editor demo, the cursor marker sometimes not shown properly.

Expected Behavior
Show cursor markers of participants in the editor.

Actual Behavior
The cursor marker of the participant which has left still shown.

Steps to Reproduce
It shows sometimes

  1. open a file as userA,
  2. open a file as userB,
  3. put the two users’ cursor at the same position in each editor (type sth.)
  4. close/leave one user’s editor
  5. open the same project file
  6. extra cursor marker appears at the previous cursor position

Hi Maggie, thanks for the bug report.

Does the cursor usually disappear after a short time? Or does it stick around indefinitely?

This demo uses anonymous authentication, meaning a temporary user is created each time the page is loaded and you enter a Display Name. Even if the display name is the same, a new and separate user will be created. Since the demo doesn’t have time to fire a “logout” event when the window unloads (is refreshed, etc), the server doesn’t know immediately that the user is no longer there. Thus, a new user (again, possibly with the same “display name”) could join the project and briefly still see the presence of the previously connected user. It should only be a few seconds before the server detects that the previous user has become disconnected (there are ping/pong events sent every ~30 seconds or so).

A production implementation of this sort of application would have persistent (“real”) domain users, such that when a user reconnects the server knows that it is the same user, which would avoid this sort of behavior.

We don’t recommend using anonymous authentication in production due to the obvious security concerns (anyone could just connect and use all of the API however they like).

Does that make sense?

Hi Alec,

Thanks for your reply.

If the cursor was shown, it would keep shown and lost control (if you have many lines and scroll the editor, the position of the cursor is fixed, it won’t scroll with lines) until refresh the page.

Thanks for the suggestion that don’t use anonymous authentication in production. I tried to connect convergence with JWT and some problems encountered. After install @convergence/jwt-util, it hints me to install a pacakge named dns, after I install that, when require/import jwt-util in file, the following error occurs.
image
image

The jwt-util library is just a small utility to be included on the server side to generate JWT tokens which can be used to authenticate with Convergence. There are a number of different libraries for every major programming language: https://jwt.io/

As for your dependency problem, I’m afraid we can’t debug local installation issues. I just npm installed that library just fine, without needing any additional installations. Clearing your npm cache / installing from scratch might help.

Thanks for your help, I can use the jwt successfully now.

And I found another problem. Still in the code editor demo, If I set the ace mode as python, then follow the following steps:

  1. create a file
  2. type anything including "" or '', e.g. print ("abc")
  3. close the file tab
  4. reopen the file
  5. extra double quotation marks appear, e.g. print ("abc""""")

Yes, I just reproduced. Please create a new issue here: https://github.com/convergencelabs/code-editor-demo