Need to connect websocket in java application

Hello, I am new in rasa. I am not able to connect with rasa using socket. I am using java. So, please help me. or share some examples.

Hi @priteshlakkad and welcome to the Rasa community!

Could you share some more details about what’s not working? Logs and error reports would allow us to help you :slight_smile:

Hello @m-vdb, Thanks for the reply. I try to connect with the rasa WebSocket with the java stomp client. here are my code

        WebSocketClient client = new StandardWebSocketClient();
        WebSocketStompClient stompClient = new WebSocketStompClient(client);
        stompClient.setMessageConverter(new MappingJackson2MessageConverter());
        StompSessionHandler sessionHandler = new MyStompSessionHandler();
        stompClient.connect(URL, sessionHandler);

If you have any example to connect with the java client. Can you please share with us?

@priteshlakkad I would like to do the same thing. Were you able to do it somehow?

Did you try the socket.io java client?

https://socketio.github.io/socket.io-client-java/installation.html

No, because in reality what I have to do is slightly different. I have a backend developed in spring which, in addition to exporting certain API, configures a stomp channel to allow communication between an android app and a frontend developed in angular. Now I would like to integrate a Rasa bot into this system and implement a handoff mechanism (similar to what is described in How to Build a “Human” Handoff Feature with Rasa) . For this reason I am interested in understanding if the Websocket Channel supports the STOMP protocol or if I need to implement a custom connector.

I dont know STOMP but looks like another protocol implemented using the websocket API https://stomp.github.io/ after reading this a bit.

Rasa is using socket.io and thus i dont think it supports the STOMP protocol by default. socket.io uses websocket API when it is available but does not follow all the bits and pieces of websocket API. you are better creating your own custom connector in this case

1 Like