0
votes

I have read the section, Tracking client connections and disconnections, in the Channel API for Java documentation.

It has the following code:

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

How would I create a handler for _ah/channel/connected/ or _ah/channel/disconnected? I want to notify or alert connected users when a user is disconnected.

1

1 Answers

1
votes

You just create those handlers like any other handler.

Put in the app.yaml something like:

- 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