Socket.io-PingPong
Shortcut to on and emit. Pingpong as you receive the event and returns in the same role.
Reason:
With socket "emit" I requested and received the data and then to "emit". I decided to reduce the process by creating the PingPong
Install
npm install --save socket.io-pingpong
Features
You can use ping pong or pp to call the methods
- emit(name, args, callback) Same socket.emit, but returns a given value on the server callback
- on(name, callback) socket.on the same as, but performs emit passing to the callback
Example
server.js
var app = ;var server = ;var io = server;var pingpong = ; server; // you port app; io;
client.html