Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/in/erail/common/FramworkConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ public static class Json {
}

}

public static class SockJS {
public static final String BRIDGE_EVENT_RAW_MESSAGE_ADDRESS = "address";
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.vertx.reactivex.ext.web.handler.sockjs;

import in.erail.common.FramworkConstants;
import io.vertx.core.Handler;
import io.vertx.core.json.JsonObject;

/**
*
Expand All @@ -10,7 +12,80 @@ public class DefaultBridgeEventHandler implements Handler<BridgeEvent> {

@Override
public void handle(BridgeEvent pEvent) {

JsonObject rawMessage = pEvent.getRawMessage();
String address = null;

if (rawMessage != null) {
address = rawMessage.getString(FramworkConstants.SockJS.BRIDGE_EVENT_RAW_MESSAGE_ADDRESS);
}

switch (pEvent.type()) {
case PUBLISH:
handlePublish(address, pEvent);
break;
case RECEIVE:
handleRecieve(address, pEvent);
break;
case REGISTER:
handleRegister(address, pEvent);
break;
case SEND:
handleSend(address, pEvent);
break;
case SOCKET_CLOSED:
handleSocketClose(pEvent);
break;
case SOCKET_CREATED:
handleSocketCreated(pEvent);
break;
case SOCKET_IDLE:
handleSocketIdle(pEvent);
break;
case SOCKET_PING:
handleSocketPing(pEvent);
break;
case UNREGISTER:
handleUnregister(address, pEvent);
break;
}

}

public void handlePublish(String pAddress, BridgeEvent pEvent) {
pEvent.complete(true);
}

public void handleRecieve(String pAddress, BridgeEvent pEvent) {
pEvent.complete(true);
}

public void handleRegister(String pAddress, BridgeEvent pEvent) {
pEvent.complete(true);
}


public void handleSend(String pAddress, BridgeEvent pEvent) {
pEvent.complete(true);
}

public void handleSocketClose(BridgeEvent pEvent) {
pEvent.complete(true);
}

public void handleSocketCreated(BridgeEvent pEvent) {
pEvent.complete(true);
}

public void handleSocketIdle(BridgeEvent pEvent) {
pEvent.complete(true);
}

public void handleSocketPing(BridgeEvent pEvent) {
pEvent.complete(true);
}

public void handleUnregister(String pAddress, BridgeEvent pEvent) {
pEvent.complete(true);
}

}