1

Hi So i am trying to run the socket.io-java-client from Gottox and simple by just opening the project in eclips(import) AND running BasicExample.java i am getting this error

Error while handshaking Server returned HTTP response code: 400 for URL: http://localhost:3000/socket.io/1/

I tried many solution but was not able to run it, also i am running the nodejs server on port 3000.

var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);

app.get('/', function(req, res){
res.sendfile('index.html');
});

io.on('connection', function(socket){
console.log('a user connected');

socket.on('message', function(msg){
io.emit('message', msg);
console.log('1111111111111111111');
});
});

http.listen(3000, function(){
console.log('listening on *:3000');
});
user614946
  • 599
  • 5
  • 10
  • 27

1 Answers1

2

Install an older version (<1.0) of socket.io on your node server:

npm uninstall socket.io
npm install -g socket.io@0.9.17

I used the Gottox library in my project and it doesn't seem to work with socket.io version 1.0+

A more recent Java socket.io library that works with version 1.0+

samgak
  • 23,944
  • 4
  • 60
  • 82
  • Thanks it worked!!, but is there any chance it work on newer version?? – user614946 Oct 18 '15 at 14:10
  • I think the library would have to be updated. On github it looks like it hasn't been updated since 2013. I'm not 100% sure however. – samgak Oct 18 '15 at 14:52