i am developing a web application with angular 4 and java. I am using server sent events to send some text data to the frontend. In the backend i am using jersey and this is my backend code
eventOutput.write(new OutboundEvent.Builder()
.id(decodedToken)
.name("responseBody")
.data(String.class, respBody.toString()).build());
Frontend i am using angular 4 and the code looks like
var evtSource = new EventSource("url");
source.addEventListener('eventName', (event) => {
console.log(event);
});
Everything works fine in Mozilla firefox. When i use chrome with tomcat and windows everything works fine. But with tomcat+linux and chrome, i see the error in the console.as
EventSource's response has a charset ("iso-8859-1") that is not UTF-8. Aborting the connection.
What could be the issue. What is the fix? Please help. Any help would be appreciated. Thanks.
Tomcat supports charset : iso-8859-1 by default. Please try
@Produces("application/json;charset=UTF-8")
eventOutput.write(new OutboundEvent.Builder()
.id(decodedToken)
.name("responseBody")
.data(String.class, respBody.toString()).build());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With