use of io.crossbar.autobahn.wamp.types.SubscribeOptions in project autobahn-java by crossbario.
the class Subscribe method parse.
public static Subscribe parse(List<Object> wmsg) {
MessageUtil.validateMessage(wmsg, MESSAGE_TYPE, "SUBSCRIBE", 4);
long request = MessageUtil.parseLong(wmsg.get(1));
Map<String, Object> options = (Map<String, Object>) wmsg.get(2);
String match = null;
if (options.containsKey("match")) {
match = (String) options.get("match");
if (!match.equals(MATCH_EXACT) && !match.equals(MATCH_PREFIX) && !match.equals(MATCH_EXACT)) {
throw new ProtocolError("match must be one of exact, prefix or wildcard.");
}
}
boolean getRetained = getOrDefault(options, "get_retained", false);
String topic = (String) wmsg.get(3);
SubscribeOptions opt = new SubscribeOptions(match, true, getRetained);
return new Subscribe(request, opt, topic);
}
Aggregations