Well. I finally figured it out myself.
How to handle (Object... args) in an EVENT_CONNECT call listen method?
I have not figured this out yet. But I look.
What is a good minimal set of events that I can implement to get connection information
These three methods would be sufficient:
connect: successful connection activated.
connect_error: about a connection error.
connect_timeout: Fired with connection timeout.
Source: Socket.io Docs
How should I process (Object... args) when confirming an issue?
So, I rummaged through the docs and found this :
Server (app.js)
var io = require('socket.io')(80); io.on('connection', function (socket) { socket.on('ferret', function (name, fn) { fn('woot'); }); });
Client
socket.on('connect', function () { // TIP: you can avoid listening on `connect` and listen on events directly too! socket.emit('ferret', 'tobi', function (data) { console.log(data); // data will be 'woot' }); });
So args will be what the server sent as a parameter to the callback. So this is how you would get Java client code for the above server code:
public void call(Object... args) { String response = (String)args[0];
The parameter can also be JSON or any of the supported data types in socket.io:
we send the string, but you can also do JSON data with the org.json package and even support binary data!
Shahim
source share