001package org.xbib.elasticsearch.websocket.client;
002
003import org.jboss.netty.channel.Channel;
004import org.jboss.netty.channel.ChannelFuture;
005import org.jboss.netty.handler.codec.http.websocketx.WebSocketFrame;
006
007/**
008 * A WebSocket client.
009 */
010public interface WebSocketClient<F extends ChannelFuture, Frame extends WebSocketFrame> {
011
012    /**
013     * The channel this client has opened.
014     *
015     * @return the channel
016     */
017    Channel channel();
018
019    /**
020     * Connect to host and port.
021     *
022     * @return Connect future. Fires when connected.
023     */
024    F connect();
025
026    /**
027     * Disconnect from the server
028     *
029     * @return Disconnect future. Fires when disconnected.
030     */
031    F disconnect();
032
033    /**
034     * Send data to server
035     *
036     * @param frame Data for sending
037     * @return Write future. Will fire when the data is sent.
038     */
039    F send(Frame frame);
040}