Open aashikhameed opened 7 years ago
hi...how can you configure the server side?
i am using default configuration by Zyro and i am using ActiveMQ
but i cannot connect to ws://localhost:8080/stomp
instead ws://localhost:61614/**what ever**
this is my client side.
`public class StompActivity extends AppCompatActivity { private final String TAG = this.getClass().getSimpleName().toUpperCase(); private StompClient mStompClient;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_stomp);
MessageModel model = new MessageModel();
model.setName("You know who");
model.setContent("This is last message");
model.setFrom("C");
model.setSessiondId("23487239423947234987239");
Gson gson = new Gson();
String messageJson = gson.toJson(model);
mStompClient = Stomp.over(WebSocket.class, "ws://192.168.0.104:61614/stomp");
mStompClient.connect();
if (mStompClient.isConnected()){
Log.d("aaaa : ","onCreate: connected");
}
mStompClient.topic("/topic/hello").subscribe(message -> {
Log.d("dddd - ", "Received "+message.toString());
});
mStompClient.send("/app/hello", "asdfasdfasdfs ").subscribe();
mStompClient.lifecycle().subscribe(lifecycleEvent -> {
switch (lifecycleEvent.getType()) {
case OPENED:
Log.d(TAG, "Stomp connection opened");
break;
case ERROR:
Log.e(TAG, "Error", lifecycleEvent.getException());
break;
case CLOSED:
Log.d(TAG, "Stomp connection closed");
break;
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
mStompClient.disconnect();
}
`
and this is my configuration in my grails application.
@MessageMapping("/hello") @SendTo("/topic/hello") protected String hello(DestinationUser map) { println "map = "+map brokerMessagingTemplate.convertAndSend "/topic/hello", 'Nama : '+map.name+"<br>Content : "+map.content+"<br>Session Id : "+map.sessiondId+"<br>From : "+map.from }
what must i do?
@aashikhameed if you are use correct ssl certificate its look as library bug. In my plans use okhttp-ws instead WebSocket library as transport, its possible fix error
@gryphonest create separate issue (and post you android logs from lib)
@NaikSoftware I have checked my ssl certificates and its working fine. I will look on the okhttp-ws library which you have mentioned. Requesting to fix the issue as soon as possible. Thanks.
@NaikSoftware Also i have the same issue.. When client is connected after some time it is getting close automatically . How to prevent from this ???
D/WebSocketsConnectionProvider: onClose: code=1006 reason= remote=true D/WebSocketsConnectionProvider: Emit lifecycle event: CLOSED
`remote=true´ - check you server configuration. For example nginx by default have timeout 60s.
@NaikSoftware I'm not able to connect the https request
//Error Log. D/WebSocketsConnectionProvider: onMessage: CONNECTED heart-beat:0,0
D/WebSocketsConnectionProvider: Emit STOMP message: CONNECTED heart-beat:0,0
D/WebSocketsConnectionProvider: onClose: code=1006 reason= remote=true D/WebSocketsConnectionProvider: Emit lifecycle event: CLOSED E/WebSocketsConnectionProvider: onError java.lang.NullPointerException: ssl == null at com.android.org.conscrypt.NativeCrypto.SSL_read_BIO(Native Method) at com.android.org.conscrypt.OpenSSLEngineImpl.unwrap(OpenSSLEngineImpl.java:477) at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:1014)at org.java_websocket.SSLSocketChannel2.unwrap(SSLSocketChannel2.java:150) at org.java_websocket.SSLSocketChannel2.readRemaining(SSLSocketChannel2.java:254)at org.java_websocket.SSLSocketChannel2.readMore(SSLSocketChannel2.java:321) at org.java_websocket.SocketChannelIOHelper.readMore(SocketChannelIOHelper.java:28) at org.java_websocket.client.WebSocketClient.interruptableRun(WebSocketClient.java:238)at org.java_websocket.client.WebSocketClient.run(WebSocketClient.java:188)at java.lang.Thread.run(Thread.java:818) D/WebSocketsConnectionProvider: Emit lifecycle event: ERROR