This repository was archived by the owner on Mar 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 387
/
Copy pathIOCallback.java
60 lines (52 loc) · 1.66 KB
/
IOCallback.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
* socket.io-java-client IOCallback.java
*
* Copyright (c) 2012, ${author}
* socket.io-java-client is a implementation of the socket.io protocol in Java.
*
* See LICENSE file for more information
*/
package io.socket;
import org.json.JSONObject;
/**
* The Interface IOCallback. A callback interface to SocketIO
* WARNING: Do NOT use "Thread.sleep" in the callback methods
*/
public interface IOCallback {
/**
* On disconnect. Called when the socket disconnects and there are no further attempts to reconnect
*/
void onDisconnect();
/**
* On connect. Called when the socket becomes ready so it is now able to receive data
*/
void onConnect();
/**
* On message. Called when the server sends String data.
*
* @param data the data.
* @param ack an {@link IOAcknowledge} instance, may be <code>null</code> if there's none
*/
void onMessage(String data, IOAcknowledge ack);
/**
* On message. Called when the server sends JSON data.
*
* @param json JSON object sent by server.
* @param ack an {@link IOAcknowledge} instance, may be <code>null</code> if there's none
*/
void onMessage(JSONObject json, IOAcknowledge ack);
/**
* On [Event]. Called when server emits an event.
*
* @param event Name of the event
* @param ack an {@link IOAcknowledge} instance, may be <code>null</code> if there's none
* @param args Arguments of the event
*/
void on(String event, IOAcknowledge ack, Object... args);
/**
* On error. Called when socket is in an undefined state. No reconnect attempts will be made.
*
* @param socketIOException the last exception describing the error
*/
void onError(SocketIOException socketIOException);
}