Skip to content

ClientEndPoint interface

Matěj Bucek edited this page Mar 18, 2020 · 1 revision

ClientEndPoint interface

This is a Client EndPoint interface. You will receive all data and info there.

You shouldn't use EndPoint annotation here.

Example:

public class ClientEP implements ClientEndPoint{

	public void onOpen(Client client) {
		System.out.println("Client: open");
		try {
			client.sendString("Hi");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void onMessage(Client client, Message message) {
		System.out.println("Server: " + message.getString());
	}

	public void onError(Client client, Error error) {
		System.out.println("Error");
	}

	public void onClose(Client client) {
		System.out.println("Client close");
	}
}

Clone this wiki locally