Closed gycgabriel closed 1 year ago
I am not sure if I should access the editor through port 3000 or port 5001 (localhost:5001/test)?
It doesn't seem to work for port 3000 (localhost:3000/collab) and for port 5001, the basic feature works but whenever the user refreshes the page, the number of connections and disconnections increase. This is what I mean:
User connected: mIMnNMnLtUMtx6aoAAAZ
User connected: mIMnNMnLtUMtx6aoAAAZ
User connected: mIMnNMnLtUMtx6aoAAAZ
User disconnected: mIMnNMnLtUMtx6aoAAAZ
User disconnected: mIMnNMnLtUMtx6aoAAAZ
User disconnected: mIMnNMnLtUMtx6aoAAAZ
User connected: je1ZdPoVnuOhW_1hAAAb
User connected: je1ZdPoVnuOhW_1hAAAb
User connected: je1ZdPoVnuOhW_1hAAAb
User connected: je1ZdPoVnuOhW_1hAAAb
User disconnected: je1ZdPoVnuOhW_1hAAAb
User disconnected: je1ZdPoVnuOhW_1hAAAb
User disconnected: je1ZdPoVnuOhW_1hAAAb
User disconnected: je1ZdPoVnuOhW_1hAAAb
User connected: n7QbS7fwhwcak5fjAAAd
User connected: n7QbS7fwhwcak5fjAAAd
User connected: n7QbS7fwhwcak5fjAAAd
User connected: n7QbS7fwhwcak5fjAAAd
User connected: n7QbS7fwhwcak5fjAAAd
User disconnected: n7QbS7fwhwcak5fjAAAd
User disconnected: n7QbS7fwhwcak5fjAAAd
User disconnected: n7QbS7fwhwcak5fjAAAd
User disconnected: n7QbS7fwhwcak5fjAAAd
User disconnected: n7QbS7fwhwcak5fjAAAd
I see why. Each time someone visits localhost:5001/test, the socket io connection listener starts, even if there are already event listeners doing the same thing before. Move the io.on("connection", ...) outside
This is a prototype right - meaning that we're not going to merge this?
I see why. Each time someone visits localhost:5001/test, the socket io connection listener starts, even if there are already event listeners doing the same thing before. Move the io.on("connection", ...) outside
Thanks for the catch. I suppose for the io listener calls within API calls I should use one-time listeners also
This is a prototype right - meaning that we're not going to merge this?
I assumed we were going to work on it iteratively, so we can merge this, and then polish it - code editor instead of text editor etc. the frontend I roughly made was just to check that it can be separated and it works across different localhosts, so that can be replaced as well
Testing
For testing I used Restman to send packets
API