未收到Google-Drive推送通知 [英] Not getting Google-Drive push notifications

查看:241
本文介绍了未收到Google-Drive推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注文档 https://developers.google.com/drive/push接收来自Google Drive的推送通知。


  1. 我的网域已注册(位于API控制台的API访问面板中)。 >
  2. 我在注册的域中有一个自定义程序,它监听htpps(使用自签名证书)。 https://myveryowndomain.bc.com/drive/notifications

  3. 为任何更改正确创建通知渠道(获取响应代码200)。

  4. 我对Google云端硬盘文件进行了更改,但没有任何内容涉及到 2 ,甚至没有同步消息。


  5. 我缺少什么?

      CONFIG: - -------------请求-------------- 
    POST https://www.googleapis.com/drive/v2/changes/watch
    Accept-Encoding:gzip
    Authorization:Bearer 1 / QRYL1ZHO4KyUmjkbHVWXCWglxJ5e6-xxxxxxxxxxxxx
    User-Agent:push-test-project Google-HTTP-Java-Client / 1.15.0-rc(gzip)
    Content-Type:application / json; charset = UTF-8
    内容长度:150

    2013年7月24日6:02:04 com.google.api.client.http.HttpRequest执行
    CONFIG: curl -v --compressed -X POST -H'Accept-Encoding:gzip'-H'Authorization:Bearer 1 / QRYL1ZHO4KyUmjkbHVWXCWglxJ5e6-xxxxxxxxxxxxx'-H User-Agent:push-test-project Google-HTTP-Java-Client / 1.15.0-rc(gzip)'-H'Content-Type:application / json; charset = UTF-8'-d'@ - ' - 'https://www.googleapis.com/drive/v2/changes/watch'<<< $$$
    2013年7月24日6:02:04 com.google.api.client.util.LoggingByteArrayOutputStream close
    CONFIG:总计:155字节
    2013年7月24日6:02 :04 PM com.google.api.client.util.LoggingByteArrayOutputStream close
    CONFIG:{address:https://myveryowndomain.bc.com/drive/notifications,id:f143f7ba-759a -42b8-8748-e39a71ba13cc,type:web_hook}
    2013年7月24日6:02:08 com.google.api.client.http.HttpResponse< init>


    CONFIG:-------------- RESPONSE --------------
    HTTP / 1.1 200 OK
    ETag:RFvxxXV9yoZniidCHgcusodAlXI / AaEAn8d9Ma5bpJZNmM0F72Crxxx
    内容长度:247
    X-XSS-Protection:1; mode = block
    过期:1990年1月1日星期五00:00:00 GMT
    服务器:GSE
    X-Content-Type-Options:nosniff
    Pragma:no-cache
    缓存控制:no-cache,no-store,max-age = 0,必须重新验证
    X-Frame-Options:SAMEORIGIN
    Date:Wed,24 Jul 2013 09:02: 08 GMT
    Content-Encoding:gzip
    Content-Type:application / json; charset = UTF-8

    2013年7月24日6:02:08 com.google.api.client.util.LoggingByteArrayOutputStream close
    CONFIG:总计:296字节
    七月24,2013 6:02:08 PM com.google.api.client.util.LoggingByteArrayOutputStream close
    CONFIG:{
    kind:api#channel,
    id: f143f7ba-759a-42b8-8748-e39a71ba13cc,
    resourceId:_X2yFKJJ6yLq3eIrw3OSxxxxxxx,
    resourceUri:https://www.googleapis.com/drive/v2/changes?includeDeleted = true& includeSubscribed = true& maxResults = 100& alt = json,
    token:,
    expiration:1374660126357
    }


    解决方案

    自签名SSL似乎是这里的问题。这不仅仅是加密。这也是关于信任问题。
    您可以从 StartSSL CACert


    FYI,expires标题不是频道的到期时间。这是关于缓存的信息。
    您可以在响应主体的到期日字段中找到您的真实到期时间。它以unix时间格式表示,您的回复1374660126357实际上是周三,4月1日45531 03:05:57 GMT。更改频道的默认到期时间为1周。


    I'm following the document https://developers.google.com/drive/push to receive push notifications from Google Drive.

    1. My domain is registered (in the API Access pane in the APIs Console).
    2. I have a custom program in the registered domain listening over htpps (with a Self-signed certificate). https://myveryowndomain.bc.com/drive/notifications
    3. Notification channels are properly created for any change (get response code 200).
    4. I make changes in my Google Drive files but nothing comes to 2, not even the sync message.

    Am I missing something?

    CONFIG: -------------- REQUEST  --------------
    POST https://www.googleapis.com/drive/v2/changes/watch
    Accept-Encoding: gzip
    Authorization: Bearer 1/QRYL1ZHO4KyUmjkbHVWXCWglxJ5e6-xxxxxxxxxxxxx
    User-Agent: push-test-project Google-HTTP-Java-Client/1.15.0-rc (gzip)
    Content-Type: application/json; charset=UTF-8
    Content-Length: 150
    
    Jul 24, 2013 6:02:04 PM com.google.api.client.http.HttpRequest execute
    CONFIG: curl -v --compressed -X POST -H 'Accept-Encoding: gzip' -H 'Authorization: Bearer 1/QRYL1ZHO4KyUmjkbHVWXCWglxJ5e6-xxxxxxxxxxxxx' -H 'User-Agent: push-test-project Google-HTTP-Java-Client/1.15.0-rc (gzip)' -H 'Content-Type: application/json; charset=UTF-8' -d '@-' -- 'https://www.googleapis.com/drive/v2/changes/watch' << $$$
    Jul 24, 2013 6:02:04 PM com.google.api.client.util.LoggingByteArrayOutputStream close
    CONFIG: Total: 155 bytes
    Jul 24, 2013 6:02:04 PM com.google.api.client.util.LoggingByteArrayOutputStream close
    CONFIG: {"address":"https://myveryowndomain.bc.com/drive/notifications","id":"f143f7ba-759a-42b8-8748-e39a71ba13cc","type":"web_hook"}
    Jul 24, 2013 6:02:08 PM com.google.api.client.http.HttpResponse <init>
    
    
    CONFIG: -------------- RESPONSE --------------
    HTTP/1.1 200 OK
    ETag: "RFvxxXV9yoZniidCHgcusodAlXI/AaEAn8d9Ma5bpJZNmM0F72Crxxx"
    Content-Length: 247
    X-XSS-Protection: 1; mode=block
    Expires: Fri, 01 Jan 1990 00:00:00 GMT
    Server: GSE
    X-Content-Type-Options: nosniff
    Pragma: no-cache
    Cache-Control: no-cache, no-store, max-age=0, must-revalidate
    X-Frame-Options: SAMEORIGIN
    Date: Wed, 24 Jul 2013 09:02:08 GMT
    Content-Encoding: gzip
    Content-Type: application/json; charset=UTF-8
    
    Jul 24, 2013 6:02:08 PM com.google.api.client.util.LoggingByteArrayOutputStream close
    CONFIG: Total: 296 bytes
    Jul 24, 2013 6:02:08 PM com.google.api.client.util.LoggingByteArrayOutputStream close
    CONFIG: {
     "kind": "api#channel",
     "id": "f143f7ba-759a-42b8-8748-e39a71ba13cc",
     "resourceId": "_X2yFKJJ6yLq3eIrw3OSxxxxxxx",
     "resourceUri": "https://www.googleapis.com/drive/v2/changes?includeDeleted=true&includeSubscribed=true&maxResults=100&alt=json",
     "token": "",
     "expiration": "1374660126357"
    }
    

    解决方案

    Self-signed SSL seems to be the problem here. It's not only about encryption. It's also about trust issue. You can get free SSL from StartSSL or CACert.

    FYI, expires header is not expiration time of the channel. It's information about cache. Your real expiration time of the channel can be found at "expiration" field of the response body. It is represented in unix time format and your response "1374660126357" is actually "Wed, 01 Apr 45531 03:05:57 GMT". Default expiration time for changes channel is 1 week.

    这篇关于未收到Google-Drive推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆