public final class WebSocketEcho extends Object implements WebSocketListener
Constructor and Description |
---|
WebSocketEcho() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String... args) |
void |
onClose(int code,
String reason)
Called when the server sends a close message.
|
void |
onFailure(IOException e)
Called when the transport-layer of this web socket errors during
communication.
|
void |
onMessage(okio.BufferedSource payload,
WebSocket.PayloadType type)
Called when a server message is received.
|
public void onMessage(okio.BufferedSource payload, WebSocket.PayloadType type) throws IOException
WebSocketListener
type
indicates whether the
payload
should be interpreted as UTF-8 text or binary data.onMessage
in interface WebSocketListener
IOException
public void onClose(int code, String reason)
WebSocketListener
close()
or as an unprompted
message from the server.onClose
in interface WebSocketListener
code
- The
public void onFailure(IOException e)
WebSocketListener
onFailure
in interface WebSocketListener
public static void main(String... args) throws IOException
IOException
Copyright © 2015. All rights reserved.