org.bdware.client.ws.WSHandler Maven / Gradle / Ivy
package org.bdware.client.ws;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import javax.websocket.MessageHandler;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
public class WSHandler implements MessageHandler.Whole {
LinkedList receivedMsg = new LinkedList<>();
LinkedHashMap> waitList;
Handler h;
public WSHandler(Handler h) {
this.h = h;
}
@Override
public void onMessage(String arg0) {
synchronized (receivedMsg) {
JsonObject json = new JsonParser().parse(arg0).getAsJsonObject();
// System.out.println("[WSHandler] onMessage:" + arg0);
if (h != null)
h.handle(json);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy