JR Galia
JR Galia

Reputation: 17269

App Engine Channel API Connection and Disconnection

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.

Upvotes: 0

Views: 524

Answers (1)

Shay Erlichmen
Shay Erlichmen

Reputation: 31928

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

Upvotes: 1

Related Questions