
pl.bristleback.server.bristle.messages.MessageSender Maven / Gradle / Ivy
// Bristleback plugin - Copyright (c) 2010 bristleback.googlecode.com
// ---------------------------------------------------------------------------
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
// This library is distributed in the hope that it will be useful,
// but without any warranty; without even the implied warranty of merchantability
// or fitness for a particular purpose.
// You should have received a copy of the GNU Lesser General Public License along
// with this program; if not, see .
// ---------------------------------------------------------------------------
package pl.bristleback.server.bristle.messages;
import org.jwebsocket.api.WebSocketServer;
import org.jwebsocket.token.Token;
/**
* Message senders are designed for sending message to connectors specified by condition object.
* Condition object type is not restricted, so implementation can choose the way it will be used.
* All senders are provided by plugin with jwebsocket server implementation and {@link pl.bristleback.server.bristle.messages.MessageDispatcher} implementation.
* It is recommended to not send messages directly by server, but by invoking {@link pl.bristleback.server.bristle.messages.MessageDispatcher#addMessage(WebSocketMessage)} method.
* To add certain message sender, view documentation of used {@link pl.bristleback.server.bristle.config.MessageContainerResolver} implementation.
* Added senders are hold in {@link pl.bristleback.server.bristle.messages.MessageSendersExporter} class
* and this class should be used to get senders.
*
* Created on: 2010-09-03 16:07:47
*
* @author Wojciech Niemiec
*/
public interface MessageSender {
/**
* Sends message to connectors obtained by processing conditions object.
* Every implementation can freely interpret condition object, so it can be map of conditions, or directly connector.
*
* @param token websocket token.
* @param conditionsObject conditions object.
*/
void sendMessage(Token token, T conditionsObject);
/**
* Sets message dispatcher. Method is invoked by plugin at server start.
*
* @param dispatcher message dispatcher.
*/
void setMessageDispatcher(MessageDispatcher dispatcher);
/**
* Sets jwebsocket server implementation. Method is invoked by plugin at server start.
*
* @param server jwebsocket server.
*/
void setServer(WebSocketServer server);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy