Getting HTTP/1.1 204 No Content when I try to push the message

1,399 views
Skip to first unread message

prasad iyer

unread,
Dec 11, 2013, 8:11:01 PM12/11/13
to gcm-for-chr...@googlegroups.com
I have published the app on Google Chrome Webstore. And created native app & chrome app on google console.
I am able to get the access token for the sending the message the problem is when I try to the push the message over the cloud I get error HTTP/1.1 204 No Content ( I am getting null content). And even the notification is not displayed on the console. Does anyone have any idea what am I missing.


Following is the code

        java.util.Map<String, String> payload = new java.util.HashMap<String, String>();
        payload.put("channelId", channelId);
        payload.put("subchannelId", subchannelId);
        payload.put("payload", message);
        System.out.println("Access Token : " + token.getAccess_token());
        HttpClient client = (HttpClient) ctx.getBean("httpclient");
        PostMethod method = new PostMethod(ClientConfig.messageurl);
        method.setRequestHeader("Host", "googleapis.com");
        method.setRequestHeader("Content-Type", "application/json");
        method.setRequestHeader("Authorization", token.getToken_type() + " "
                + token.getAccess_token());
       
        Gson gson = new Gson();
        final String _payload = gson.toJson(payload).toString();
        System.out.println(_payload);
        RequestEntity entity = new ByteArrayRequestEntity(_payload.getBytes());
        method.setRequestEntity(entity);
        try {
            int rc = client.executeMethod(method);
            if ( rc == 400){
               
                System.out.println("something went wrong with the token... refreshing ");
                System.out.println(method.getResponseBodyAsString());
                token.setAccess_token(null);
                sendMessage(message, channelId, subchannelId, retryvalue++);
            }
            if (rc != HttpStatus.SC_OK) {
                System.out.println(method.getResponseBodyAsString());
                throw new RuntimeException(method.getStatusLine().toString());
            }

        } catch (HttpException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

thanks

Dmitry Titov

unread,
Dec 11, 2013, 8:58:29 PM12/11/13
to prasad iyer, Google
204 No Content is the header that says the post actually happened successfully. Do you get the notification delivered into the app?


--
You received this message because you are subscribed to the Google Groups "GCM for Chrome feedback" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gcm-for-chrome-fe...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Message has been deleted

prasad iyer

unread,
Dec 11, 2013, 11:29:36 PM12/11/13
to gcm-for-chr...@googlegroups.com, prasad iyer
I wonder why I don't get response in Chrome App. I have registered both Chrome App and Native App under one project. Chrome App is shamelessly copied from guestbook-app on Github. By the way thanks for clearing my doubt about 204 response code. I would make those changes on the server

prasad iyer

unread,
Dec 11, 2013, 11:31:48 PM12/11/13
to gcm-for-chr...@googlegroups.com, prasad iyer
I wonder why I don't get response in Chrome App. I have registered both Chrome App and Native App under one project. Chrome App is shamelessly copied from guestbook-app on Github. By the way thanks for clearing my doubt about 204 response code. I would make those changes on the server


On Wednesday, December 11, 2013 5:58:29 PM UTC-8, Dmitry Titov wrote:

Dmitry Titov

unread,
Dec 11, 2013, 11:42:52 PM12/11/13
to prasad iyer, Google
Some quick checks:
- is the browser profile where the the app is installed signed into Google? (Menu -> "Signed into ...")?
- in that browser, if you open a tab and navigate to "chrome://sync-internals/", then click "Notifications", does it say State: INVALIDATIONS_ENABLED on top?
- are you using the ChannelId that this app returned from getChanngeId() API?


prasad iyer

unread,
Dec 12, 2013, 3:01:02 PM12/12/13
to gcm-for-chr...@googlegroups.com, prasad iyer
Hi Dimitry,
 - The user is signed into Google
 - chrome://sync-internals > Notification says State: TRANSIENT_INVALIDATION_ERROR
 - To send the message I use the channelId returned by the browser when the chrome app starts.

Yesterday I was trying on my windows machine. Today I am trying on the macbook.
thank you

Dmitry Titov

unread,
Dec 12, 2013, 5:25:58 PM12/12/13
to prasad iyer, Pavel Yatsuk, Nicolas Zea, Google
TRANSIENT_INVALIDATION_ERROR is not a good thing. Does it stay this way all the time or goes away after restarting Chrome? It sounds like the user is not really signed in properly...


--

prasad iyer

unread,
Dec 12, 2013, 5:44:51 PM12/12/13
to gcm-for-chr...@googlegroups.com, prasad iyer, Pavel Yatsuk, Nicolas Zea
Yes it stays in that state all the time I have restarted Chrome a lot of time. Removed and redeployed the Chrome App too.
I am signed into Chrome with my google credentials. Is there anything I can do to make State: TRANSIENT_INVALIDATION_ERROR go away. The chrome version is Version 31.0.1650.63.

I have 2 step verification on my account do you think that would be a problem. It won't ask me for the 6 digit code for next 30 days though.

regards
To unsubscribe from this group and stop receiving emails from it, send an email to gcm-for-chrome-feedback+unsub...@googlegroups.com.

prasad iyer

unread,
Dec 12, 2013, 6:29:20 PM12/12/13
to Nicolas Zea, Pavel Yatsuk, chrome-sync-dev, gcm-for-chr...@googlegroups.com

Please find the attached HTML file
Let me know if you need more details. Thank you guys

prasad

On Dec 12, 2013 3:07 PM, "Nicolas Zea" <z...@google.com> wrote:
What kind of network are you on? Could you send a screenshot of both your about:sync main tab and the notifications tab?
Sync Internals.html

prasad iyer

unread,
Dec 14, 2013, 9:02:53 PM12/14/13
to Pavel Yatsuk, Nicolas Zea, chrome-sync-dev, gcm-for-chr...@googlegroups.com
We have LAN and it has firewall. All the http/https connections are
made through the proxy. Is there a way to configure XMPP on chrome
browser to use Http/Https.


On Sat, Dec 14, 2013 at 3:53 PM, Pavel Yatsuk <pav...@google.com> wrote:
> TRANSIENT_INVALIDATION_ERROR usually means chrome failed to connect to XMPP
> server, at the same time sync cycle recently successfully completed. This
> means http traffic is Ok but tcp is not. Thus Nicolas' question about
> network type.
>
> Prasad, what kind of network are you on? Any firewalls that would block
> traffic?
>>>>>> an email to gcm-for-chrome-fe...@googlegroups.com.

prasad iyer

unread,
Dec 16, 2013, 6:15:18 PM12/16/13
to Pavel Yatsuk, chrome-sync-dev, Nicolas Zea, gcm-for-chr...@googlegroups.com

Here you go Pavel

prasad

send from android

On Dec 16, 2013 12:41 PM, "Pavel Yatsuk" <pav...@google.com> wrote:
Could you capture network traffic and send it to me? I'll try to see what's going on:
- Sign out of chrome.
- navigate to about:net-internals, this will start capturing network events 
- sign in to chrome and wait for few seconds. 
- stop capture and export events on about:net-internals.
net-internals-log.json

prasad iyer

unread,
Dec 19, 2013, 1:33:00 PM12/19/13
to gcm-for-chr...@googlegroups.com, Pavel Yatsuk, chrome-sync-dev, Nicolas Zea
There were couple of issues I faced and thanks to everyone to help me get the application working. I would summarize the things I did for building the application.

1. Google Cloud Console - Create the Credentials for the chrome application(this would be in Installed Application section of Credentials) and web application. So that the web application can send the messages and chrome application can receive the message. Both the credentials should be part of one project.
2. Make sure the Chrome Application XMPP port is not behind the firewall.


Thank you very much 

Reply all
Reply to author
Forward
0 new messages