|
@@ -33,18 +33,19 @@ public class SocketService extends BaseObservable<EventListener> {
|
|
|
private static final String EVENT_UPDATE_PAYOUT = "client-update-payout";
|
|
|
private static final String EVENT_REVERSE_RESULT = "client-reserves-result";
|
|
|
private static final String EVENT_RESET_AMOUNT = "client-reset-amount";
|
|
|
+ private static final String EVENT_START_COUNT_DOWN = "client-start-count-down";
|
|
|
private Socket mSocket;
|
|
|
|
|
|
public void startListening(String token, int channelType) throws URISyntaxException {
|
|
|
IO.Options options = IO.Options.builder()
|
|
|
.setExtraHeaders(singletonMap("authorization", singletonList(token)))
|
|
|
.build();
|
|
|
- Log.d("Socket", "startListening mSocket"+ channelType);
|
|
|
+ Log.d("Socket", "startListening mSocket" + channelType);
|
|
|
if (channelType == 2) {
|
|
|
mSocket = IO.socket(URI.create(SOCKET_2), options);
|
|
|
} else if (channelType == 3) {
|
|
|
mSocket = IO.socket(URI.create(SOCKET_3), options);
|
|
|
- } else if(channelType == 4) {
|
|
|
+ } else if (channelType == 4) {
|
|
|
mSocket = IO.socket(URI.create(SOCKET_4), options);
|
|
|
} else {
|
|
|
mSocket = IO.socket(URI.create(SOCKET_1), options);
|
|
@@ -57,6 +58,7 @@ public class SocketService extends BaseObservable<EventListener> {
|
|
|
mSocket.on(EVENT_UPDATE_PAYOUT, updatePayout);
|
|
|
mSocket.on(EVENT_REVERSE_RESULT, reverseResult);
|
|
|
mSocket.on(EVENT_RESET_AMOUNT, resetAmount);
|
|
|
+ mSocket.on(EVENT_START_COUNT_DOWN, startCountDown);
|
|
|
mSocket.on(EVENT_DISCONNECT, disconnectListener);
|
|
|
mSocket.on(EVENT_CONNECT_ERROR, connectionErrorListener);
|
|
|
mSocket.connect();
|
|
@@ -104,6 +106,12 @@ public class SocketService extends BaseObservable<EventListener> {
|
|
|
for (EventListener listener : getListeners())
|
|
|
listener.onResetAmount(rawMessage);
|
|
|
};
|
|
|
+ private Emitter.Listener startCountDown = args -> {
|
|
|
+ Log.d("Socket", "startCountDown socketservice");
|
|
|
+ final String rawMessage = args[0].toString();
|
|
|
+ for (EventListener listener : getListeners())
|
|
|
+ listener.onStartCountDown(rawMessage);
|
|
|
+ };
|
|
|
private Emitter.Listener connectListener = args -> {
|
|
|
Log.d("Socket", "onConnect s...fghfhgfhgfhfghgf");
|
|
|
for (EventListener listener : getListeners())
|