Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Socket.io event handlers.

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 639
    Comment on it

    Hello Readers!

    If you are creating any real time web application then node.js with socket.io is very worth for it. It connects client to server very easily with no time. Perfect example of node.js and socket.io is a Chat application or online real time 2 player games. Below are some of the events that are use in socket.io .

    io.sockets.socket()

    This event handler is used for emiting to specific clients.

    io.sockets.emit()

    This event handler is used to send to all connected clients (same as socket.emit)

    io.sockets.on()

    This event handler is used to initial connection from a client.

    socket.on()

    This event handler is used for event listener, can be called on client to execute on server

    socket.emit()

    This event handler is used to send to all connected clients

    socket.broadcast.emit()

    This event handler is used to send to all connected clients except the one that sent the message

    Use above all socket.io event handlers and grow your coding style.

    Happy Coding !

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: