Testing js lib on production
To troubleshoot some issue with websocket connection on production, I need to test the library (reconnecting-websocket) that we use to manage the connection.
I want to do some testing in dev console. The problem is that the library is not available in the global scope. And we can't simply import it from the dev console.
Thanks to this article, it has detailed approaches on how to solve this.
I decided to use the .
eval() method - be sure to read the caveat on the security issue though
There's no need to use
eval() actually. Since we're loading external script through
src attribute, that will be immediately executed when we use
Enter this code through the dev console:-
Simple snippet above allow me to start receiving data from server and help in my troubleshooting.