org.glassfish.grizzly.websockets
Interface WebSocketListener

All Known Implementing Classes:
ChatApplication, WebSocketAdapter, WebSocketApplication

public interface WebSocketListener

Interface to allow notification of events occurring on specific WebSocket instances.


Method Summary
 void onClose(WebSocket socket, DataFrame frame)
           Invoked when WebSocket.onClose(DataFrame) has been called on a particular WebSocket instance.
 void onConnect(WebSocket socket)
           Invoked when the opening handshake has been completed for a specific WebSocket instance.
 void onFragment(WebSocket socket, byte[] fragment, boolean last)
           Invoked when WebSocket.onFragment(boolean, byte[]) has been called on a particular WebSocket instance.
 void onFragment(WebSocket socket, String fragment, boolean last)
           Invoked when WebSocket.onFragment(boolean, String) has been called on a particular WebSocket instance.
 void onMessage(WebSocket socket, byte[] bytes)
           Invoked when WebSocket.onMessage(String) has been called on a particular WebSocket instance.
 void onMessage(WebSocket socket, String text)
           Invoked when WebSocket.onMessage(String) has been called on a particular WebSocket instance.
 void onPing(WebSocket socket, byte[] bytes)
           Invoked when WebSocket.onPing(DataFrame) has been called on a particular WebSocket instance.
 void onPong(WebSocket socket, byte[] bytes)
           Invoked when WebSocket.onPong(DataFrame) has been called on a particular WebSocket instance.
 

Method Detail

onClose

void onClose(WebSocket socket,
             DataFrame frame)

Invoked when WebSocket.onClose(DataFrame) has been called on a particular WebSocket instance.

Parameters:
socket - the WebSocket being closed.
frame - the closing DataFrame sent by the remote end-point.

onConnect

void onConnect(WebSocket socket)

Invoked when the opening handshake has been completed for a specific WebSocket instance.

Parameters:
socket - the newly connected WebSocket

onMessage

void onMessage(WebSocket socket,
               String text)

Invoked when WebSocket.onMessage(String) has been called on a particular WebSocket instance.

Parameters:
socket - the WebSocket that received a message.
text - the message received.

onMessage

void onMessage(WebSocket socket,
               byte[] bytes)

Invoked when WebSocket.onMessage(String) has been called on a particular WebSocket instance.

Parameters:
socket - the WebSocket that received a message.
bytes - the message received.

onPing

void onPing(WebSocket socket,
            byte[] bytes)

Invoked when WebSocket.onPing(DataFrame) has been called on a particular WebSocket instance.

Parameters:
socket - the WebSocket that received the ping.
bytes - the payload of the ping frame, if any.

onPong

void onPong(WebSocket socket,
            byte[] bytes)

Invoked when WebSocket.onPong(DataFrame) has been called on a particular WebSocket instance.

Parameters:
socket - the WebSocket that received the pong.
bytes - the payload of the pong frame, if any.

onFragment

void onFragment(WebSocket socket,
                String fragment,
                boolean last)

Invoked when WebSocket.onFragment(boolean, String) has been called on a particular WebSocket instance.

Parameters:
socket - the WebSocket received the message fragment.
fragment - the message fragment.
last - flag indicating if this was the last fragment.

onFragment

void onFragment(WebSocket socket,
                byte[] fragment,
                boolean last)

Invoked when WebSocket.onFragment(boolean, byte[]) has been called on a particular WebSocket instance.

Parameters:
socket - the WebSocket received the message fragment.
fragment - the message fragment.
last - flag indicating if this was the last fragment.


Copyright © 2013 Oracle Corporation. All Rights Reserved.