changed server-side node file to fix listener function -- put inside connection function