WebFaction
Community site: login faq

I am using socket.io-client.java and socket.io 1.2.1 on my node server for my android project and the android socket connects with the server fine but after some minutes it automatically disconnect and reconnect repeatedly. i can't figure out the problem, can someone help me?

i am using socket.io-client-0.1.1.jar, engine.io-client-0.2.1.jar and Java-WebSocket-1.3.0.jar libraries.

here is the java code

private void socketTest() throws URISyntaxException{
 socket = IO.socket("http://192.168.169.2:8082");
 socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {

  @Override
  public void call(Object... args) {
    socket.emit("test", "awesome");

  }

}).on(Socket.EVENT_DISCONNECT, new Emitter.Listener() {

  @Override
  public void call(Object... args) {}

});
socket.connect();

}

and here is the server side code

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

socket.on('test',function(msg){
   console.log("This is "+msg);
});
});

asked 09 Jan '15, 12:26

Miqe
1112
accept rate: 0%


192.168.169.2 is not a WebFaction server IP, so we're not able to tell you why your app might have trouble maintaining a connection to it.

permanent link

answered 09 Jan '15, 20:06

seanf
12.2k41836
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×67
×8
×1

question asked: 09 Jan '15, 12:26

question was seen: 7,218 times

last updated: 09 Jan '15, 20:06

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM