CIDARLAB / Neptune-iGEM-2016

BSD 2-Clause "Simplified" License
11 stars 12 forks source link

Websocket connections get reset when opening up 2 pages with websocket functionality #40

Open johanos opened 7 years ago

johanos commented 7 years ago

When you open up the data collection page and the specify page, you reset the websocket connection

This, I believe, is due to the implementation. var currentWebsocket = require('./websocket'); this gets called in any controller that uses websocket functionality. then you access the socket from the export in websocket.js. currentWebsocket.socket();

then this is used to emit.

files affected = translateLFR.js, compileMint.js, serialcommunication.js

what I believe the issue is, is that when a page reloads (and a controller is reloaded) it will go through the process of handshaking the websocket connection again (and close it for the other page) so the last page that was open (if it used websockets) would have no functionality.

LOOK INTO: trying to unify everything into app.js, so that there is a single websocket connection (generated once, not in every controller) and then manage that since app.js is persistent through the life of the application.