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

  • SEARCH
  • Home
  • 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 8124277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:25:00+00:00 2026-06-06T06:25:00+00:00

So this was working on this project a few months ago. I’m using Google

  • 0

So this was working on this project a few months ago. I’m using Google App Engine’s Channel API to push messages to my GWT app. I’m using http://code.google.com/p/gwt-gae-channel/ to interact through GWT.

Lets say I send 1 message to the client: “First Message”

The client will receive the message, “First Message” just fine.

Then let’s say I send another message, “Second Message” to the client.

The client will again receive the message, “First Message”.

This will continue happening. There have been some instances where I’ll receive the second message, and it will be the message that gets stuck repeating.

When I finally close the page, and thus close the channel, I again receive the repeated message without sending something from the server.

Does anyone have any idea what is going on? I don’t think this was happening when I was working on this a few months ago, and I can see no changes to the GAE Channel API.


Here is some code:

        String json = AutoBeanHelper.toJson(proxy);
        log.fine("Item's JSON Received: " + json);

        List<ChannelEntity> channels = channelDAO.getByUserId();
        if (channels.size() > 1) {
            log.warning("Multiple channels for single user detected.");
        }

        ChannelService channelService = ChannelServiceFactory.getChannelService();
        for (ChannelEntity channel : channels) {
            channelService.sendMessage(new ChannelMessage(channel.getClientId(), json));
        }

So whenever I store a new item of a specific type (this is in that entities update function):
1. I turn it into JSON.
2. I then log that JSON.
3. I get that users channel.
4. I send it to that users channel.

When I look at my logs, I see that the variable above that I’m logging is showing correctly, meaning I’m logging the correct JSON message but when I display the JSON in an alert on the client-side as soon as it gets to the client, it’s the previous message that seems to be stuck repeating. I really don’t see what I could be doing wrong here.

Let me know if you would like to see another part of the code. For good measure, here is the code on the client:

eventBus.addHandler(ReceivedChannelTokenEvent.TYPE, new ReceivedChannelTokenEventHandler() {
        @Override
        public void onEvent(ReceivedChannelTokenEvent event) {
            ChannelFactory.createChannel(event.getChannelToken(), new ChannelCreatedCallback() {
                @Override
                public void onChannelCreated(Channel channel) {
                    final Socket channelSocket = channel.open(new SocketListener() {
                        @Override
                        public void onOpen() {
                            Window.alert("Channel Opened");
                        }
                        @Override
                        public void onMessage(String json) {
                            Window.alert(json);
                            eventBus.fireEvent(new MessageReceivedEvent(json));

                        }
                        @Override
                        public void onError(SocketError error) {
                            Window.alert("Channel Error: " + error.getDescription());
                            if ( error.getDescription().equals(CHANNEL_ERROR_TOKEN_TIME_OUT) ) {
                                eventBus.fireEvent(new ChannelTimeOutEvent());
                            }
                        }
                        @Override
                        public void onClose() {
                            Window.alert("Channel Closed.");
                        }
                    });

                    Window.addWindowClosingHandler(new Window.ClosingHandler() {
                        @Override
                        public void onWindowClosing(ClosingEvent event) {
                            channelSocket.close();
                        }
                    });
                }
            });
        }
    });
  • 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-06T06:25:01+00:00Added an answer on June 6, 2026 at 6:25 am

    So I was finally able to figure it out. It seems that in the onMessage function within the app when I call

    eventBus.fireEvent(new MessageReceivedEvent(json));
    

    it seems that it never returns from this, thus never exiting the onMessage function in the code, causing me to receive the same message repetitively.

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

Sidebar

Related Questions

I was working for a few months on the project without even noticing this,
I am upgrading a project I had working previously. This code worked a few
I've been working on a java spring project for a few months now. I
I have been using Google Test for a few months now and I have
I am working on this project where I wish to classify the general mood
I'm working on this project where the client has a virtual server setup. I
I'm working on this project and the customer wants it to integrate with a
I'm working on this project and I have to open a new browser tab.
I am working on this project where I need to read in a lot
I've been working on this project for about two weeks now. I don't understand

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.