Forum Stats

  • 3,838,749 Users
  • 2,262,397 Discussions


EventSource reconnect timeout (Jax-RS)

Kronos72it Member Posts: 119
edited Sep 2, 2015 6:20AM in Java Technology & XML

Hello I am discovering Jax-Rs through Jersey 2.20 .

If I understood the javascript EventSource object behave as (default) after 3 second of disconnection it try to re connect .

From my point of view it is a strange behavior because reconnection must take place just when the first connection is lost but in my case EventSource try to reconnect after Jax-Rs endpoint do :

// on server


Then EventSource figure there is disconnection about problem but it is just a closing of streming.

No error on client :

//on client

        czmlEventSource.onError = function(e) {

            e = e || event, msg = '';

            switch( ){

                // if reconnecting

                case EventSource.CONNECTING:

                    msg = 'Reconnecting…';


                // if error was fatal

                case EventSource.CLOSED:

                    msg = 'Connection failed. Will not retry.';



            console.error("XXX "+msg);


If it is true , I need to avoid this behavior otherwise every subsequent reconnection download data from beginning .

please, help !

No effect if I leveraging Jersey to disabling reconnection :

final OutboundEvent.Builder eventBuilder= new OutboundEvent.Builder();"czml").reconnectDelay(-1);,v).mediaType(MediaType.APPLICATION_JSON_TYPE);

        final OutboundEvent event =;


Message was edited by: kronos72it to insert a statement about"czml").reconnectDelay(-1);

This discussion has been closed.