org.glassfish.tyrus.spi
Interface SPIRemoteEndpoint


public interface SPIRemoteEndpoint

This interface represents the unique object which represents the other end of the web socket connection (i.e. the remote client) to the SDK. So the provider must supply one of these for each web socket connection. There must be precisely one instance of this type per connection. The provider must not manufacture a new instance of this type per incoming message, for example.

Author:
dannycoward

Method Summary
 void close(int code, java.lang.String reason)
          Close the underlying connection using the web socket defined codes.
 java.lang.String getUri()
          Returns the URI http request as a String.
 boolean isConnected()
          Return true iff the connection is active.
 void send(byte[] data)
          Send the given data, throwing the IOException if the message is not sent.
 void send(java.lang.String data)
          Send the given string, throwing the IOException if the message is not sent.
 

Method Detail

isConnected

boolean isConnected()
Return true iff the connection is active.

Returns:
true if connected, false otherwise.

send

void send(java.lang.String data)
          throws java.io.IOException
Send the given string, throwing the IOException if the message is not sent.

Parameters:
data - String that is going to be sent.
Throws:
java.io.IOException

send

void send(byte[] data)
          throws java.io.IOException
Send the given data, throwing the IOException if the message is not sent.

Parameters:
data - byte[] that is going to be sent.
Throws:
java.io.IOException

close

void close(int code,
           java.lang.String reason)
           throws java.io.IOException
Close the underlying connection using the web socket defined codes.

Parameters:
code - the closing code defined in the web socket protocol.
reason - for closing.
Throws:
java.io.IOException

getUri

java.lang.String getUri()
Returns the URI http request as a String.

Returns:
URI as a String.


Copyright © 2012. All Rights Reserved.