com.github.eventsource.client
Class EventSource

java.lang.Object
  extended by com.github.eventsource.client.EventSource

public class EventSource
extends Object


Field Summary
static long DEFAULT_RECONNECTION_TIME_MILLIS
           
 
Constructor Summary
EventSource(Executor executor, long reconnectionTimeMillis, URI uri, EventSourceClientHandler eventSourceHandler)
          Creates a new EventSource client.
EventSource(URI uri, EventSourceClientHandler eventSourceHandler)
           
 
Method Summary
 EventSource close()
          Close the connection
 org.jboss.netty.channel.ChannelFuture connect()
           
 EventSource join()
          Wait until the connection is closed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RECONNECTION_TIME_MILLIS

public static final long DEFAULT_RECONNECTION_TIME_MILLIS
See Also:
Constant Field Values
Constructor Detail

EventSource

public EventSource(Executor executor,
                   long reconnectionTimeMillis,
                   URI uri,
                   EventSourceClientHandler eventSourceHandler)
Creates a new EventSource client. The client will reconnect on lost connections automatically, unless the connection is closed explicitly by a call to close(). For sample usage, see examples at GitHub.

Parameters:
executor - the executor that will receive events
reconnectionTimeMillis - delay before a reconnect is made - in the event of a lost connection
uri - where to connect
eventSourceHandler - receives events
See Also:
close()

EventSource

public EventSource(URI uri,
                   EventSourceClientHandler eventSourceHandler)
Method Detail

connect

public org.jboss.netty.channel.ChannelFuture connect()

close

public EventSource close()
Close the connection

Returns:
self

join

public EventSource join()
                 throws InterruptedException
Wait until the connection is closed

Returns:
self
Throws:
InterruptedException - if waiting was interrupted


Copyright © 2011. All Rights Reserved.