Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.3)

Part Number E41849-02

weblogic.websocket
Interface WebSocketListener

All Known Implementing Classes:
WebSocketAdapter

Deprecated. As of release 12.1.3, replaced by JSR356: Java API for WebSocket

@Deprecated
public interface WebSocketListener

This interface is used to handle WebSocket messages. The lifecycle of its instance is managed by the container. All of the methods on this interface are callback methods. The container will call various methods during the lifetime of the WebSocket.

A WebSocketListener may use any of the resource injection functionality described in Chapter EE.5 of the Java EE Platform specification, "Resource, Naming and Injection".

See Also:
WebSocket

Method Summary
 boolean accept(WSHandshakeRequest request, WSHandshakeResponse response)
          Deprecated. This method is called before upgrading the HTTP connection to a WebSocket connection.
 void destroy()
          Deprecated. This method is called before the application is undeployed.
 void init(WebSocketContext context)
          Deprecated. This method is called after the instance of this interface is created.
 void onClose(WebSocketConnection connection, ClosingMessage message)
          Deprecated. This method is called when the WebSocket is closed by the WebSocket client.
 void onError(WebSocketConnection connection, Throwable error)
          Deprecated. This method is called if the container encounters difficulty.
 void onFragment(WebSocketConnection connection, boolean last, byte[] payload)
          Deprecated. This method is called when a CONTINUATION data frame containing binary payload is received.
 void onFragment(WebSocketConnection connection, boolean last, String payload)
          Deprecated. This method is called when a CONTINUATION data frame containing text payload is received.
 void onMessage(WebSocketConnection connection, byte[] payload)
          Deprecated. This method is called when a BINARY data frame is received.
 void onMessage(WebSocketConnection connection, String payload)
          Deprecated. This method is called when a TEXT data frame is received.
 void onOpen(WebSocketConnection connection)
          Deprecated. This method is called after the WebSocket opening handshake succeeds and the connection is established.
 void onPing(WebSocketConnection connection, byte[] payload)
          Deprecated. This method is called when a PING control frame is received.
 void onPong(WebSocketConnection connection, byte[] payload)
          Deprecated. This method is called when a PONG control frame is received.
 void onTimeout(WebSocketConnection connection)
          Deprecated. This method is called when the WebSocket does not receive any message for the specified timeout period.
 

Method Detail

init

void init(WebSocketContext context)
Deprecated. 
This method is called after the instance of this interface is created.

Parameters:
context - the WebSocketContext associated with the WebSocket that is listened on by this listener.

destroy

void destroy()
Deprecated. 
This method is called before the application is undeployed.


accept

boolean accept(WSHandshakeRequest request,
               WSHandshakeResponse response)
Deprecated. 
This method is called before upgrading the HTTP connection to a WebSocket connection. Applications can decide whether to accept the upgrade request based on the HTTP request and handshake message.

Parameters:
request - the WebSocket opening handshake request.
response - the WebSocket opening handshake response.
Returns:
true if upgrading to WebSocket is acceptable; false otherwise.

onOpen

void onOpen(WebSocketConnection connection)
Deprecated. 
This method is called after the WebSocket opening handshake succeeds and the connection is established.

Parameters:
connection - the WebSocket connection is established.

onMessage

void onMessage(WebSocketConnection connection,
               String payload)
Deprecated. 
This method is called when a TEXT data frame is received.

Parameters:
connection - the WebSocket connection receiving the message.
payload - the received payload from the TEXT data frame.

onMessage

void onMessage(WebSocketConnection connection,
               byte[] payload)
Deprecated. 
This method is called when a BINARY data frame is received.

Parameters:
connection - the WebSocket connection receiving the message.
payload - the received payload from the BINARY data frame.

onFragment

void onFragment(WebSocketConnection connection,
                boolean last,
                String payload)
Deprecated. 
This method is called when a CONTINUATION data frame containing text payload is received.

Parameters:
connection - the WebSocket connection receiving the message.
last - indicates if this is the last fragment to be received.
payload - the received text payload from the CONTINUATION data frame.

onFragment

void onFragment(WebSocketConnection connection,
                boolean last,
                byte[] payload)
Deprecated. 
This method is called when a CONTINUATION data frame containing binary payload is received.

Parameters:
connection - the WebSocket connection receiving the message.
last - indicates if this is the last fragment to be received.
payload - the received binary payload from the CONTINUATION data frame.

onPing

void onPing(WebSocketConnection connection,
            byte[] payload)
Deprecated. 
This method is called when a PING control frame is received. The container is responsible for sending back a pong message before calling this method.

Parameters:
connection - the WebSocket connection receiving the PING control frame.
payload - the received payload from the PING control frame.

onPong

void onPong(WebSocketConnection connection,
            byte[] payload)
Deprecated. 
This method is called when a PONG control frame is received.

Parameters:
connection - the WebSocket connection receiving the PONG control frame.
payload - the received payload from the PONG control frame.

onTimeout

void onTimeout(WebSocketConnection connection)
Deprecated. 
This method is called when the WebSocket does not receive any message for the specified timeout period. The WebSocket will be closed by the container after this method is called.

Parameters:
connection - the WebSocket connection that timed out.
See Also:
WebSocket

onError

void onError(WebSocketConnection connection,
             Throwable error)
Deprecated. 
This method is called if the container encounters difficulty.

Parameters:
connection - the WebSocket connection having difficulty.
error - the error encountered in the container.

onClose

void onClose(WebSocketConnection connection,
             ClosingMessage message)
Deprecated. 
This method is called when the WebSocket is closed by the WebSocket client. The WebSocket will be closed and removed by the container after this method is called.

Parameters:
connection - the WebSocket connection receiving the CLOSE control frame.
message - the close message received.

Copyright 1996, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Oracle Fusion Middleware
Java API Reference for Oracle WebLogic Server
12c (12.1.3)

Part Number E41849-02