Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/350.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 应用程序引擎通道API连接和断开_Java_Google App Engine_Channel Api - Fatal编程技术网

Java 应用程序引擎通道API连接和断开

Java 应用程序引擎通道API连接和断开,java,google-app-engine,channel-api,Java,Google App Engine,Channel Api,我已经阅读了文档中的“跟踪客户端连接和断开连接”部分 其代码如下: // In the handler for _ah/channel/connected/ ChannelService channelService = ChannelServiceFactory.getChannelService(); ChannelPresence presence = channelService.parsePresence(req); 如何为\u ah/channel/connected/或\u ah

我已经阅读了文档中的“跟踪客户端连接和断开连接”部分

其代码如下:

// In the handler for _ah/channel/connected/
ChannelService channelService = ChannelServiceFactory.getChannelService();
ChannelPresence presence = channelService.parsePresence(req);

如何为
\u ah/channel/connected/
\u ah/channel/disconnected
创建处理程序?我想在用户断开连接时通知或提醒连接的用户。

您只需像其他处理程序一样创建这些处理程序

在app.yaml中输入如下内容:

- url: /_ah/channel/connected/
  servlet: com.[MY_APP].server.channel.ChannelConnected
  name: ChannelConnected
- url: /_ah/channel/disconnected/
  servlet: com.[MY_APP].server.channel.ChannelDisconnected
  name: ChannelDisconnected