Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Meteor] SSE doesn't work if TrackMessageSizeInterceptor is used #1835

Closed
slovdahl opened this issue Jan 8, 2015 · 4 comments
Closed

[Meteor] SSE doesn't work if TrackMessageSizeInterceptor is used #1835

slovdahl opened this issue Jan 8, 2015 · 4 comments

Comments

@slovdahl
Copy link
Contributor

slovdahl commented Jan 8, 2015

Tested with latest 2.3.0-SNAPSHOT and modified meteor-chat sample:

diff --git a/samples/meteor-chat/src/main/java/org/atmosphere/samples/chat/MeteorChat.java b/samples/meteor-chat/src/main/java/org/atmosphere/samples/chat/MeteorChat.java
index 64e50c0..84776b5 100755
--- a/samples/meteor-chat/src/main/java/org/atmosphere/samples/chat/MeteorChat.java
+++ b/samples/meteor-chat/src/main/java/org/atmosphere/samples/chat/MeteorChat.java
@@ -15,6 +15,7 @@
  */
 package org.atmosphere.samples.chat;

+import org.atmosphere.client.TrackMessageSizeInterceptor;
 import org.atmosphere.config.service.MeteorService;
 import org.atmosphere.cpr.AtmosphereResourceEventListenerAdapter;
 import org.atmosphere.cpr.BroadcasterFactory;
@@ -34,7 +35,7 @@ import java.util.Date;
  *
  * @author Jeanfrancois Arcand
  */
-@MeteorService(path = "/*", interceptors = {AtmosphereResourceLifecycleInterceptor.class})
+@MeteorService(path = "/*", interceptors = {TrackMessageSizeInterceptor.class, AtmosphereResourceLifecycleInterceptor.class})
 public class MeteorChat extends HttpServlet {

     @Inject
diff --git a/samples/meteor-chat/src/main/webapp/jquery/application.js b/samples/meteor-chat/src/main/webapp/jquery/application.js
index 8657f8a..ef0ca33 100644
--- a/samples/meteor-chat/src/main/webapp/jquery/application.js
+++ b/samples/meteor-chat/src/main/webapp/jquery/application.js
@@ -11,7 +11,8 @@ $(function () {
     var request = { url: document.location.toString() + 'meteor',
                     contentType : "application/json",
                     logLevel : 'debug',
-                    transport : 'websocket' ,
+                    transport : 'sse' ,
+                    trackMessageLength: true,
 reconnectInterval : 5000,
                     fallbackTransport: 'long-polling'};

Run in jetty and open in browser, try to write a name, press enter, nothing happens.

@slovdahl
Copy link
Contributor Author

slovdahl commented Jan 8, 2015

Oops, error on my side. It did actually work. Need to investigate further why it's failing in my own application.

@slovdahl
Copy link
Contributor Author

slovdahl commented Jan 8, 2015

Found the root cause of it. For SSE to work the AtmosphereResourceLifecycleInterceptor must be used.

@jfarcand
Copy link
Member

jfarcand commented Jan 8, 2015

@slovdahl AtmosphereResourceLifecycleInterceptor was listed in your changes above. You tested without? Then it will only works if you add a call to AtmosphereResource#suspend

@slovdahl
Copy link
Contributor Author

slovdahl commented Jan 8, 2015

Yes, I meant that it was missing in my own application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants