The SseEmitter included in the spring framework does not seem to include a capable text/plain parser in the underlying converter set.
Whenever i try to send any form of event, the emitter automatically includes a "data:" prefix, which it adds with the text/plain mediatype.
After a bit of digging i noticed some of the underlying functions use a subset of spring's default MessageConverters, this subset does not include the default String converter.
So, whenever i try to send any type of event like so:
SseEmitter.SseEventBuilder event = SseEmitter.event()
.data("SSE MVC - " + LocalTime.now().toString())
.id(String.valueOf(i))
.name("sse event - mvc");
emitter.send(event);
it will inevitably result in a
java.lang.IllegalArgumentException: No suitable converter for class java.lang.String
The suggestion would be to either include the standard string converter, or let the SseEmitter use a different mediatype for pre- and suffixes that are supported in the Converter chain for the emitter.
I'm currently on spring boot version 2.1.12.RELEASE
The SseEmitter included in the spring framework does not seem to include a capable text/plain parser in the underlying converter set.
Whenever i try to send any form of event, the emitter automatically includes a "data:" prefix, which it adds with the text/plain mediatype.
After a bit of digging i noticed some of the underlying functions use a subset of spring's default MessageConverters, this subset does not include the default String converter.
So, whenever i try to send any type of event like so:
it will inevitably result in a
java.lang.IllegalArgumentException: No suitable converter for class java.lang.StringThe suggestion would be to either include the standard string converter, or let the SseEmitter use a different mediatype for pre- and suffixes that are supported in the Converter chain for the emitter.
I'm currently on spring boot version 2.1.12.RELEASE