Master should listen to "online" event not "listening" (fix #1)
One should use var instead of const

code-style fixed