meteor = new Meteor(this, “ws://ydapp.in:3000//websocket”);
//callback
meteor.addCallback(this);
//establish connection
try {
meteor.connect();
Toast.makeText(this, "Sucess", Toast.LENGTH_SHORT).show();
} catch (NetworkOnMainThreadException e) {
Toast.makeText(this, (CharSequence) e, Toast.LENGTH_SHORT).show();
}
if (meteor.isConnected()) {
Toast.makeText(this, "connect", Toast.LENGTH_SHORT).show();
Intent i = new Intent(MainActivity.this, Welcome.class);
startActivity(i);
} else {
Log.e("Errorr","Error");
Toast.makeText(this, "Not connect", Toast.LENGTH_SHORT).show();
meteor.reconnect();
}
This is my code but cannot connect to server it getting error…Any body help me