I am trying to implement a device pairing program with nodejs. The server is implemented by someone else and uses socket io:
var http = require('http'),
io = require('socket.io');
But one of the devices that I am pairing does not support Websocket(HTML5). Is is possible to create a socket io client without using socket io, are there any alternatives?
Thanks in advance.
socket.io supports various transports such as flashsockets and XHR long-polling. So you do not have to use a different client - it should work out of the box even without Websocket support
Speaking of alternatives... there are some client libraries e.g. for Python but I don't think there are any that run in the browser - as I said before, there's no need for them.
After a lot of try and catch, I have found that the browser that I am using, can not support buffering behaviour in Socket.IO.js . The first emit is done without buffering, therefore first pairing request can be emitted correctly. So I have changed Socket.prototype.setBuffer(true) to Socket.prototype.setBuffer(false). This may not be a clean solution, but in my case it works.
You can configure which types of fallbacks you'd like to use
io.configure("production", function() {
io.enable("browser client minification");
io.enable("browser client etag");
io.enable("browser client gzip");
io.set("transports", ['websocket', 'jsonp-polling']);
io.set("log level", 1);
});
io.configure("development", function() {
io.set("transports", ['websocket', 'jsonp-polling']);
});
you can see all the options here on the wiki