Found way to abstract over web sockets without using eval.