public class WebSocketTester extends Object
Constructor and Description |
---|
WebSocketTester(WicketTester wicketTester,
Page page)
Constructor.
|
WebSocketTester(WicketTester wicketTester,
String resourceName)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
broadcast(Application application,
String sessionId,
IKey key,
IWebSocketPushMessage message)
Broadcasts/pushes a message to specific web socket connection
|
void |
broadcastAll(Application application,
IWebSocketPushMessage message)
Broadcasts/pushes a message to all active web socket connections
|
void |
destroy() |
protected void |
onOutMessage(byte[] message,
int offset,
int length)
A callback method which may be overritten to receive messages pushed by the server
|
protected void |
onOutMessage(String message)
A callback method which may be overritten to receive messages pushed by the server
|
void |
sendMessage(byte[] message,
int offset,
int length)
Sends a binary message from the client (a test case) to the server
|
void |
sendMessage(String message)
Sends a text message from the client (a test case) to the server
|
public WebSocketTester(WicketTester wicketTester, Page page)
page
- the page that may have registered WebSocketBehavior
public WebSocketTester(WicketTester wicketTester, String resourceName)
resourceName
- the name of the shared WebSocketResource that will handle the web socket messagespublic void sendMessage(String message)
message
- the text message to send to the serverpublic void sendMessage(byte[] message, int offset, int length)
message
- the binary message to send to the serveroffset
- the offset of the binary message to start to read fromlength
- the length of bytes to read from the binary messagepublic void broadcast(Application application, String sessionId, IKey key, IWebSocketPushMessage message)
application
- The application where the web socket connection is registeredsessionId
- The id of the http session with which the web socket connection is registeredkey
- The key with which the web socket connection is registeredmessage
- The message to broadcast/pushpublic void broadcastAll(Application application, IWebSocketPushMessage message)
application
- The application where the web socket connection is registeredmessage
- The message to broadcast/pushpublic void destroy()
protected void onOutMessage(String message)
message
- the pushed text message from the serverprotected void onOutMessage(byte[] message, int offset, int length)
message
- the pushed binary message from the serveroffset
- the offset of the binary message to start to read fromlength
- the length of bytes to read from the binary messageCopyright © 2006–2022 Apache Software Foundation. All rights reserved.