Closed
Description
Now RSocket adopts "message/x.rsocket.composite-metadata.v0" and "message/x.rsocket.routing.v0" as metadata MimeType. Please consider add "text/plain" as metadata Mime type, some cases, the text just as route key. If possible, could "application/json" be added as metadata Mime type and routing key is "routing" field like following:
{
"routing": "chat_room",
....
}
Both "text/plain" and "application/json" are friendly and easy for Javascript in browser.
private String getDestination(Payload payload) {
if (this.metadataMimeType.equals(DefaultRSocketRequester.COMPOSITE_METADATA)) {
CompositeMetadata metadata = new CompositeMetadata(payload.metadata(), false);
for (CompositeMetadata.Entry entry : metadata) {
String mimeType = entry.getMimeType();
if (DefaultRSocketRequester.ROUTING.toString().equals(mimeType)) {
return entry.getContent().toString(StandardCharsets.UTF_8);
}
}
return "";
}
else if (this.metadataMimeType.equals(DefaultRSocketRequester.ROUTING)) {
return payload.getMetadataUtf8();
}
// Should not happen (given constructor assertions)
throw new IllegalArgumentException("Unexpected metadataMimeType");
}