com.google.bitcoin.protocols.channels
Class ServerConnectionEventHandler

java.lang.Object
  extended by com.google.bitcoin.protocols.channels.ServerConnectionEventHandler
Direct Known Subclasses:
NativePaymentChannelServerConnectionEventHandler

public abstract class ServerConnectionEventHandler
extends Object

A connection-specific event handler that handles events generated by client connections on a PaymentChannelServerListener


Constructor Summary
ServerConnectionEventHandler()
           
 
Method Summary
abstract  void channelClosed(PaymentChannelCloseException.CloseReason reason)
          Called when the channel was closed for some reason.
abstract  void channelOpen(Sha256Hash channelId)
          Triggered when the channel is opened and application messages/payments can begin
protected  void closeChannel()
          Closes the channel with the client (will generate a channelClosed(PaymentChannelCloseException.CloseReason) event)
abstract  void paymentIncrease(BigInteger by, BigInteger to)
          Called when the payment in this channel was successfully incremented by the client
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerConnectionEventHandler

public ServerConnectionEventHandler()
Method Detail

closeChannel

protected final void closeChannel()

Closes the channel with the client (will generate a channelClosed(PaymentChannelCloseException.CloseReason) event)

Note that this does NOT actually broadcast the most recent payment transaction, which will be triggered automatically when the channel times out by the StoredPaymentChannelServerStates, or manually by calling StoredPaymentChannelServerStates.closeChannel(StoredServerChannel) with the channel returned by StoredPaymentChannelServerStates.getChannel(com.google.bitcoin.core.Sha256Hash) with the id provided in channelOpen(com.google.bitcoin.core.Sha256Hash)


channelOpen

public abstract void channelOpen(Sha256Hash channelId)
Triggered when the channel is opened and application messages/payments can begin

Parameters:
channelId - A unique identifier which represents this channel (actually the hash of the multisig contract)

paymentIncrease

public abstract void paymentIncrease(BigInteger by,
                                     BigInteger to)
Called when the payment in this channel was successfully incremented by the client

Parameters:
by - The increase in total payment
to - The new total payment to us (not including fees which may be required to claim the payment)

channelClosed

public abstract void channelClosed(PaymentChannelCloseException.CloseReason reason)

Called when the channel was closed for some reason. May be called without a call to channelOpen(Sha256Hash).

Note that the same channel can be reopened at any point before it expires if the client reconnects and requests it.



Copyright © 2014. All rights reserved.