node.js - Newer socket.io client not connecting to older socket.io server -
i'm trying newer socket.io client connect server process using older version of socket.io, 0.9.14. i've included small example of both client , server demonstrate this. know easy answer upgrade server newer socket.io version , being done. take time , i'd see if there can make client communicate server without upgrading server. want android client able connect it's exhibiting similar connect issue simple nodejs client sample i've posted here. don't know it's identical seems worthwhile start nodejs client testing.
when client connects sees "connect sent", "finished emit", doesn't server response message. server repeatedly shows following message: "info - unhandled socket.io url". repeated until client stopped. if update server's package.json use "1.3.5" socket.io example works fine.
client package.json
{ "name": "clientjs", "version": "0.0.0", "description": "", "main": "client.js", "scripts": { "test": "echo \"error: no test specified\" && exit 1" }, "author": "", "license": "bsd-2-clause", "dependencies": { "http": "0.0.0", "socket.io": "1.3.5", "socket.io-client": "1.3.5" } }
client.js
var io = require('socket.io-client'); var serverurl = 'http://localhost:3300'; var conn = io.connect(serverurl); console.log('connect sent'); conn.emit('join', 'default', function(resp, data) { console.log('server sent resp ' + resp + " " + data); }); console.log('finished emit: join');
server package.json
{ "name": "serverjs", "version": "0.0.0", "description": "", "main": "server.js", "scripts": { "test": "echo \"error: no test specified\" && exit 1", "start": "node server.js" }, "author": "", "license": "bsd-2-clause", "dependencies": { "express": "~4.12.3", "http": "0.0.0", "socket.io": "0.9.14" } }
server.js
var express = require('express'); var app = express(); var server = require('http').createserver(app); server.listen(3300); var io = require('socket.io').listen(server, function() { console.log('listen callback called'); }); io.sockets.on('connection', function(socket) { console.log('connection: event came in'); socket.on('join', function(p1, fn) { console.log('client sent '+p1); fn(0, 'some data'); }); });
as mentioned real goal android client running against server. i'm using nodejs client make easy demonstrate problem. know how make work doesn't involve upgrading server side newer socket.io? thanks.
Comments
Post a Comment