public void act(HashMap<String, Object> cmd) { if (cmd == null) return; JsonObject notif = new JsonObject(); for (String key : cmd.keySet()) { Object value = cmd.get(key); if (value != null) { if (value instanceof byte[]) notif.putBinary(key, (byte[]) value); else if (value instanceof Boolean) notif.putBoolean(key, (Boolean) value); else if (value instanceof Number) notif.putNumber(key, (Number) value); else if (value instanceof String) notif.putString(key, (String) value); else if (value instanceof JsonArray) notif.putArray(key, (JsonArray) value); } } System.out.println("sent: \n" + notif.encode()); push(notif); }