powered by Jive Software

Websocket Openfire Issue

Hi everyone,

I’m new in this community ( sorry if this is not the place to post my question.).

I’m working with websocket plugin for openfire ( https://code.google.com/p/openfire-websockets/downloads/list , websockets-0.0.0.04.zip))

and it works fine in web.

Now, I’m trying connect my android (with autobahn, websocket client for Android http://autobahn.ws/android/getstarted ) to websocket server.

I create a WebSocketConnection with ->

WebSocketConnection ws= new WebSocketConnection();

and later:

final WebSocketConnection ws=new WebSocketConnection();

try {

 ws.connect("ws://server/ws/server?username=xxxxx&password=xxxxx&resource=spank", new           WebSocketHandler(){

           @Override

               public void onOpen(){

                     Log.d("onOpen", "connected o ws");

                ws.sendRawTextMessage(" ".getBytes());

                     }

              @Override

                public void onTextMessage(String payload){

                     Log.d("onTextMessage","message: "+payload);

                    }

                @Override

                public void onClose(int code, String reason){

                     Log.d("onClose","Connection Lost");

                }

     });

} catch (WebSocketException e1) {

e1.printStackTrace();

}

and obviusly, I get to connect with ws server but…i don’t get do Login. How can i do Login from this client?

Thanks in advance

Login should happen automatically if you connect sucessfully with websockets URL. The user name and password in URL is used to login in user to Openfire. Check the Openfire web console.

i can’t activate debug console because i haven’t installed Openfire in developer Mode.

With previous code, i get “connected to ws”, but in localhost:9090 panel , user is disconnected.

Only with this code user should be logged?

Go to admin web console (http://serevr:9090) and enable debug mode and check the log files.

If you do not send a regular heatbeat, the websocket connection will be closed. If you don not send a valid XMPP message or regular XMPP ping messages, Openfire will close your XMPP session.

when i open socket from android i get it in debug file:

2013.04.30 00:48:24 XMPPServlet - checkOrigin: Digest created for xxxxx: xxxxx: spank = af7ec1a0d87a090a753dab206cda443e

2013.04.30 00:48:24 XMPPServlet - af7ec1a0d87a090a753dab206cda443e : doWebSocketConnect : Digest created for xxxxx: xxxxx: spank

2013.04.30 00:48:24 XMPPServlet - Socket found in cache for digest af7ec1a0d87a090a753dab206cda443e

2013.04.30 00:48:24 XMPPServlet - af7ec1a0d87a090a753dab206cda443e : doWebSocketConnect : Digest created for xxxxx: xxxxx: spank

2013.04.30 00:48:24 XMPPServlet - Socket found in cache for digest af7ec1a0d87a090a753dab206cda443e

2013.04.30 00:48:24 XMPPServlet - af7ec1a0d87a090a753dab206cda443e : doWebSocketConnect : Digest created for xxxxx: xxxxx: spank

2013.04.30 00:48:24 XMPPServlet - af7ec1a0d87a090a753dab206cda443e : onOpen : Socket opened

but user doesn’t log in

Sorry. User is connected! (in disconnected status).

I forgot send presence to change status to connected.

Very thanks