org.coweb.bots
Interface Bot


public interface Bot

Interface that any coweb bot must define.


Method Summary
 void init()
          The bot Proxy will call this method when a new session has been created and a user has subscribed to this bot's service.
 void onRequest(Map<String,Object> params, String replyToken, String username)
          Called when a user make a private request to this bot.
 void onShutdown()
          Called when the bot service is to shutdown.
 void onSubscribe(String username)
          Called when a user subscribes to the service provided by this bot.
 void onSync(Map<String,Object> params, String username)
          Called when a sync events occurs in the session.
 void onUnsubscribe(String username)
          Called when a user unsubscribes to the service provided by this bot.
 void setProxy(Proxy proxy)
          Sets the proxy object this bot should use to reply to subscribes, sync, requests, etc.
 

Method Detail

init

void init()
The bot Proxy will call this method when a new session has been created and a user has subscribed to this bot's service.


onSubscribe

void onSubscribe(String username)
Called when a user subscribes to the service provided by this bot.

Parameters:
username - The username of the client subscribing.

onUnsubscribe

void onUnsubscribe(String username)
Called when a user unsubscribes to the service provided by this bot.

Parameters:
username - The username of the client unsubscribing.

onRequest

void onRequest(Map<String,Object> params,
               String replyToken,
               String username)
Called when a user make a private request to this bot.

Parameters:
params - key value pairs of parameters sent by the user.
replyToken - token associated with this request. The bot must pass this token back to the proxy when replying to this request.
username - The username of the client making this request.

onSync

void onSync(Map<String,Object> params,
            String username)
Called when a sync events occurs in the session.

Parameters:
params - key value pairs containing the sync event info.
username - the username from whom this sync originated.

onShutdown

void onShutdown()
Called when the bot service is to shutdown. Allows the bot to do any cleanup that it needs to.


setProxy

void setProxy(Proxy proxy)
Sets the proxy object this bot should use to reply to subscribes, sync, requests, etc.

Parameters:
proxy - The proxy object.


Copyright © 2011 The Dojo Foundation. All Rights Reserved.