Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7798009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:52:21+00:00 2026-06-01T23:52:21+00:00

I am currently having a problem related to SSE and Windows XP. The source

  • 0

I am currently having a problem related to SSE and Windows XP. The source code below is currently working in every Chrome I tried except for Chrome in Windows XP (?) Not sure why. This is intended to be used for a control panel, where users must use Chrome. In other words, I don’t care about IE, Firefox, etc.

The problem: Server side events works everywhere (Chrome) but not in Windows XP (Chrome). When I say it works, I mean that the message handler is called.

The code

  • Javascript code

    if (!!window.EventSource) {
       console.log("Event source available");
       var source = new EventSource('/admin/systemalert');
    
       source.addEventListener('message', function(e) {
            console.log(e.data);
       });
    
       source.addEventListener('open', function(e) {
            console.log("Connection was opened.");
       }, false);
    
       source.addEventListener('error', function(e) {
            if (e.readyState == EventSource.CLOSED) {
                console.log("Connection was closed.");
            } else {
                console.log(e.readyState);    <-- in windows XP it prints Error here
            }
       }, false);
    } else {
            console.log("No SSE available");
    }
    
  • Server side code

    @Controller
    @RequestMapping("/admin/**")
    public class AdminController {
    
            @RequestMapping("systemalert")
            public @ResponseBody String sendMessage(HttpServletResponse response) {
                    Random r = new Random();
                    response.setContentType("text/event-stream");
                    try {
                            Thread.sleep(10000);
                    } catch (InterruptedException e) {
                            e.printStackTrace();
                    }   
                    return "data:Testing 1,2,3" + r.nextInt() +"\n";
            }
    
    }
    

As stated in the code, the line console.log(e.readyState); prints “Error” when using Chrome in Windows XP. Any ideas? Anyone see anything wrong with the source code?

Thanks in advance.
Agustin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:52:23+00:00Added an answer on June 1, 2026 at 11:52 pm

    For anyone with this problem, the problem was related to the new lines needed after the data. Basically, you need two lines and not one as I was using. That way it works everywhere.

    Changing this:

    return "data:Testing 1,2,3" + r.nextInt() +"\n";
    

    To this:

    return "data:Testing 1,2,3" + r.nextInt() +"\n\n";
    

    Fixes the problem..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a problem with the below code and I am not sure
I'm currently having a problem, which seems to be related to closing a Form,
Hi I am currently having a problem with parsing an Xml string without any
I am currently having a problem with a UITableView, and more precisely with a
I'm currently having a problem with some Socket stuff. The output that I want
I am currently having a problem with the pySerial module in Python. My problem
I am currently having unnecessary trouble trying to test out RubyMine. My biggest problem
I'm currently going through the ASP.NET MVC NerdDinner tutorial and am having a problem
Problem Statement: Currently, there are two requirements namely having the correctly populated element in
I currently have CruiseControl.NET set up with SVN to automatically grab the code source

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.