org.apache.wicket.protocol.ws.api
Class WebSocketResource

java.lang.Object
  extended by org.apache.wicket.protocol.ws.api.WebSocketResource
All Implemented Interfaces:
Serializable, IResource, org.apache.wicket.util.io.IClusterable

public abstract class WebSocketResource
extends Object
implements IResource

An IResource that can be used as WebSocket endpoint

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.wicket.request.resource.IResource
IResource.Attributes
 
Constructor Summary
WebSocketResource()
           
 
Method Summary
protected  void onClose(ClosedMessage message)
          A callback method called when a WebSocket client has closed the connection to the endpoint handled by this WebSocketBehavior
protected  void onConnect(ConnectedMessage message)
          A callback method called when a WebSocket client has connected to the endpoint handled by this WebSocketBehavior
protected  void onMessage(WebSocketRequestHandler handler, BinaryMessage binaryMessage)
          A callback method called when there is a binary message sent by the client
protected  void onMessage(WebSocketRequestHandler handler, TextMessage message)
          A callback method called when there is a text message sent by the client
protected  void onPush(WebSocketRequestHandler handler, IWebSocketPushMessage message)
          A callback method called when there is a message pushed/broadcasted by the server, e.g.
 void respond(IResource.Attributes attributes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebSocketResource

public WebSocketResource()
Method Detail

onPush

protected void onPush(WebSocketRequestHandler handler,
                      IWebSocketPushMessage message)
A callback method called when there is a message pushed/broadcasted by the server, e.g. pushed by a backend service

Parameters:
handler - The request handler that can be used to send messages to the client
message - The message pushed/broadcasted by the server

onConnect

protected void onConnect(ConnectedMessage message)
A callback method called when a WebSocket client has connected to the endpoint handled by this WebSocketBehavior

Parameters:
message - the connect message with the info about the client

onClose

protected void onClose(ClosedMessage message)
A callback method called when a WebSocket client has closed the connection to the endpoint handled by this WebSocketBehavior

Parameters:
message - the close message with the info about the client

onMessage

protected void onMessage(WebSocketRequestHandler handler,
                         TextMessage message)
A callback method called when there is a text message sent by the client

Parameters:
handler - The request handler that can be used to send messages back to the client
message - The text message sent by the client

onMessage

protected void onMessage(WebSocketRequestHandler handler,
                         BinaryMessage binaryMessage)
A callback method called when there is a binary message sent by the client

Parameters:
handler - The request handler that can be used to send messages back to the client
binaryMessage - The binary message sent by the client

respond

public final void respond(IResource.Attributes attributes)
Specified by:
respond in interface IResource


Copyright © 2006–2020 Apache Software Foundation. All rights reserved.