org.botlibre.sdk
Class LiveChatConnection

java.lang.Object
  extended by org.botlibre.sdk.LiveChatConnection

public class LiveChatConnection
extends java.lang.Object

Connection class for a Live Chat, or chatroom connection. A live chat connection is different than an SDKConnection as it is asynchronous, and uses web sockets for communication.


Constructor Summary
LiveChatConnection(Credentials credentials, LiveChatListener listener)
          Create a new connection with the application credentials and the listener.
 
Method Summary
 void accept()
          Accept a private request.
 void boot(java.lang.String user)
          Boot a user from the channel.
 void connect(ChannelConfig channel, UserConfig user)
          Connection to the live chat server channel.
 void disconnect()
          Disconnect from the channel.
 void exit()
          Exit from the current private channel.
 ChannelConfig getChannel()
          Return the current channel.
 Credentials getCredentials()
          Return the current application credentials.
 LiveChatListener getListener()
           
 UserConfig getUser()
          Return the current user.
 boolean isDebug()
           
 boolean isKeepAlive()
          Return if the connection will be kept alive, and not allowed to timeout due to inactivity.
 void ping()
          Test the connection.
 void pvt(java.lang.String user)
          Request a private chat session with a user.
 void sendMessage(java.lang.String message)
          Sent a text message to the channel.
 void setDebug(boolean debug)
          Enable debugging messages (logged to System.out).
 void setKeepAlive(boolean keepAlive)
          Set if the connection should be kept alive, and not allowed to timeout due to inactivity.
 void setListener(LiveChatListener listener)
           
 void whisper(java.lang.String user, java.lang.String message)
          Send a private message to a user.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LiveChatConnection

public LiveChatConnection(Credentials credentials,
                          LiveChatListener listener)
Create a new connection with the application credentials and the listener. The listener will be notified asynchronously of messages and events.

Method Detail

connect

public void connect(ChannelConfig channel,
                    UserConfig user)
Connection to the live chat server channel. Validate the user credentials. This call is asynchronous, any error or success with be sent as a separate message to the listener.


sendMessage

public void sendMessage(java.lang.String message)
Sent a text message to the channel. This call is asynchronous, any error or success with be sent as a separate message to the listener. Note, the listener will receive its own messages.


accept

public void accept()
Accept a private request. This is also used by an operator to accept the top of the waiting queue. This can also be used by a user to chat with the channel bot. This call is asynchronous, any error or success with be sent as a separate message to the listener.


ping

public void ping()
Test the connection. A pong message will be returned, this message will not be broadcast to the channel. This call is asynchronous, any error or success with be sent as a separate message to the listener.


exit

public void exit()
Exit from the current private channel. This call is asynchronous, any error or success with be sent as a separate message to the listener.


pvt

public void pvt(java.lang.String user)
Request a private chat session with a user. This call is asynchronous, any error or success with be sent as a separate message to the listener.


boot

public void boot(java.lang.String user)
Boot a user from the channel. You must be a channel administrator to boot a user. This call is asynchronous, any error or success with be sent as a separate message to the listener.


whisper

public void whisper(java.lang.String user,
                    java.lang.String message)
Send a private message to a user. This call is asynchronous, any error or success with be sent as a separate message to the listener.


disconnect

public void disconnect()
Disconnect from the channel.


isDebug

public boolean isDebug()

setDebug

public void setDebug(boolean debug)
Enable debugging messages (logged to System.out).


getChannel

public ChannelConfig getChannel()
Return the current channel.


getUser

public UserConfig getUser()
Return the current user.


getCredentials

public Credentials getCredentials()
Return the current application credentials.


getListener

public LiveChatListener getListener()

setListener

public void setListener(LiveChatListener listener)

isKeepAlive

public boolean isKeepAlive()
Return if the connection will be kept alive, and not allowed to timeout due to inactivity.


setKeepAlive

public void setKeepAlive(boolean keepAlive)
Set if the connection should be kept alive, and not allowed to timeout due to inactivity.