如何实现连接/断开(GAE Channel API,Java)?
这是我的 app.yaml 的相关部分:
handlers:
[...]
- url: /_ah/channel/connected
servlet: com.[MYAPP].server.channel.ChannelConnected
name: ChannelConnected
- url: /_ah/channel/disconnected
servlet: com.[MYAPP].server.channel.ChannelDisconnected
name: ChannelDisconnected
- url: /*
filter: com.google.inject.servlet.GuiceFilter
login: required
[...]
inbound_services:
- channel_presence
但 App Engine 似乎都无法识别 ChannelDisconnected 和 ChannelConnected 。开发服务器 (SDK 1.6.1) 的输出:
Jan 18, 2012 1:08:37 PM com.google.appengine.tools.development.LocalResourceFileServlet doGet
Warnung: No file found for: /_ah/channel/connected/
以及网络日志:
0.1.0.10 - - [18/Jan/2012:05:01:37 -0800] "POST /_ah/channel/connected/ HTTP/1.1" 404 346 - - "[MYID].appspot.com" ms=42 cpu_ms=88 api_cpu_ms=65 cpm_usd=0.002547 instance=00c61b117ce7311fe771ffe792d63bf0a07784
This is the relevant part of my app.yaml:
handlers:
[...]
- url: /_ah/channel/connected
servlet: com.[MYAPP].server.channel.ChannelConnected
name: ChannelConnected
- url: /_ah/channel/disconnected
servlet: com.[MYAPP].server.channel.ChannelDisconnected
name: ChannelDisconnected
- url: /*
filter: com.google.inject.servlet.GuiceFilter
login: required
[...]
inbound_services:
- channel_presence
But neither ChannelDisconnected nor ChannelConnected seem to be recognized by App Engine. Output from the Dev Server (SDK 1.6.1):
Jan 18, 2012 1:08:37 PM com.google.appengine.tools.development.LocalResourceFileServlet doGet
Warnung: No file found for: /_ah/channel/connected/
And the web log:
0.1.0.10 - - [18/Jan/2012:05:01:37 -0800] "POST /_ah/channel/connected/ HTTP/1.1" 404 346 - - "[MYID].appspot.com" ms=42 cpu_ms=88 api_cpu_ms=65 cpm_usd=0.002547 instance=00c61b117ce7311fe771ffe792d63bf0a07784
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在连接和断开连接的处理程序末尾添加反斜杠:
Add a backslash to the end of your connected and disconnected handlers:
在您的 yaml 片段中,您的入站服务被注释掉。如果您的实际部署出现这种情况,则可能是导致问题的原因。
In your yaml snippet your inbound services are commented out. If this is the case on your actual deployment that might be the cause of your issues.