You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
am I able to bind different listeners for each sendText method that I call?
For example:
I have one call to authenticate my application: websocket.sendText("auth request")
I have another one to request some information: websocket.sendText("request some information").
I am receiving both responses in the same listener but I need to receive each one in a specific listener then I can handle each one differently.
Is that possible? I will leave peace of my code here:
WebSocket ws = new WebSocketFactory().createSocket(uri);
ws.addListener(new WebSocketAdapter() {
@Override
public void onTextMessage(WebSocket websocket, String message) throws Exception {
System.out.println("message: " + message);
}
});
WebSocket session = ws.connect();
if (session.isOpen()) {
//Auth request
session.sendText("auth");
//Request to get something else
session.sendText("some thing else");
}
The text was updated successfully, but these errors were encountered:
am I able to bind different listeners for each sendText method that I call?
For example:
I have one call to authenticate my application: websocket.sendText("auth request")
I have another one to request some information: websocket.sendText("request some information").
I am receiving both responses in the same listener but I need to receive each one in a specific listener then I can handle each one differently.
Is that possible? I will leave peace of my code here:
The text was updated successfully, but these errors were encountered: