"WEBNMS_5 API Docs"

com.adventnet.nms.broadcast
Class BroadcastClient

java.lang.Object
  extended by com.adventnet.nms.broadcast.BroadcastClient
All Implemented Interfaces:
SocketConnection

public class BroadcastClient
extends java.lang.Object
implements SocketConnection

This file acts as the client for Broadcast. he registers with MainSocketClient* and when a broadcast message is received shows it in the status bar by defualt The user can also register to this and receive the message and handle it.


Method Summary
 void close()
          Another interface method.
static BroadcastClient getInstance()
          This method returns the instance of broadcastClient.
 void receive(byte[] data)
          This method will be called whenever the session receives data from the server.
 void registerForResponse(BroadcastListener bl)
          the UI class should register with the BroadcastClient inorder to receive the responses.
 void send(java.lang.String message, java.lang.String criteria)
          This method is used to send message across clients.
 void unRegisterForResponse(BroadcastListener bl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static BroadcastClient getInstance()
This method returns the instance of broadcastClient. The user class can use this instance and then send the message.

Returns:
an instance of BroadcastClient

send

public void send(java.lang.String message,
                 java.lang.String criteria)
This method is used to send message across clients. The user can decide whether he wishes to send the message to all clients connected to the WebNMS-Backend server or only to the clients connected to his FE server only.

Parameters:
message - The string that has to be broadcasted.
criteria - If FECLIENTS : only to that particular FE clients. If ALLCLIENTS : to all the clients connected to the BE server thro the FE servers.

receive

public void receive(byte[] data)
Description copied from interface: SocketConnection
This method will be called whenever the session receives data from the server. The data received for this session will be passed as a byte array. The implementing session class can process the data and perform the necessary operations. It is suggested to not to perform any UI updations in the context of the same thread as it might cause some undesirable effects as JFC is not thread safe. Please use the recommended javax.swing.SwingUtilities.invokeLater(Runnable) method for UI updations.

Specified by:
receive in interface SocketConnection
Parameters:
data - The byte array received from the server will be passed.

registerForResponse

public void registerForResponse(BroadcastListener bl)
the UI class should register with the BroadcastClient inorder to receive the responses.

Parameters:
bl - Interface which listens for the message.

unRegisterForResponse

public void unRegisterForResponse(BroadcastListener bl)

close

public void close()
Another interface method. Called when connection is closed. We can free the resources.

Specified by:
close in interface SocketConnection

"WEBNMS_5 API Docs"

Copyright © 2013 ZOHO Corp., All Rights Reserved.