504 Gateway Time-Out 240000 ms when using EventSource

Viewed 266

I'm using this node.js library in order to Reconnect to an EventSource in case it closes.

The Problem

My web app is hosted on Microsoft Azure , in which i've enabled Web Sockets

After 240000ms the event source object closes with a 504 Gateway time-out error.

enter image description here

Web app architecture:

The project is designed with the Spring boot framework and this is one of my Streaming Endpoints

@GetMapping(path = "/completed/receive", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
    public Flux<Event> receiveCompleted() {
    
            return Flux.create(sink -> {
            completedProcessor.register(sink::next);
        });
    }

Headers I've tried and didn't work

  • Connection : Keep-Alive
  • Keep - Alive: timeout=500000

Enable Web Sockets from Microsoft Azure

enter image description here

How i'm listening to the endpoint with JS

var eventSourceCompleted;
        
eventSourceCompleted =  new ReconnectingEventSource("/api/completed/receive");

        

// Receive messages
eventSourceCompleted.onmessage = function (evt) {
//Do Something

};
eventSourceCompleted.onerror = function (e) {
      console.log("EventSource failed: " + e);
};
        

No matter what i try, 240k ms later the connection closes, how can that be?

0 Answers
Related