sitegui / nodejs-websocket

A node.js module for websocket server and client
MIT License
736 stars 155 forks source link

eval(string) is making connection be lost after second message received #52

Closed peq42 closed 5 years ago

peq42 commented 6 years ago

In my application, if I use eval to execute code that is inside a string, inside the conn.on part, it loses connection right after receiving the second message(and doesn't execute it too)

conn.on("text", function (str) { eval(stringInsideVariable) })

(that is inside a code which is pretty much the same as the example given in this github)

And I can't find a way around it, since I need that eval to execute the conn.sendText() if it is inside the string(which I don't know, it will depend on who's using my application)

-Is there a way to send a message back to the user from outside the function given as example? -Why is it disconnecting ?