Permalink
Browse files

removed message listener methods

  • Loading branch information...
1 parent c0976fc commit c11429aa9b69878caef34fe76e67cee884fc1dee @purplefox purplefox committed Aug 21, 2012
@@ -9,40 +9,6 @@
public interface EventBusBridgeListener {
/**
- * This method gets fired when a message gets sent to an address.
- * @param writeHandlerId The socket ID of the client who sent the message.
- * @param address The address this message was sent to.
- * @param message The sent message.
- * @return True, if the message should still be sent to the address, false otherwise.
- */
- boolean sendingMessage(String writeHandlerId, final String address, JsonObject message);
-
- /**
- * This method gets fired when a message gets published to an address.
- * @param writeHandlerId The socket ID of the client who sent the message.
- * @param address The address this message was sent to.
- * @param message The sent message.
- * @return True, if the message should still be published to the address, false otherwise.
- */
- boolean publishingMessage(String writeHandlerId, final String address, JsonObject message);
-
- /**
- * This method gets fired when a client registered to an address. It should return whether the handler should still
- * be registered.
- * @param writeHandlerId The socket ID of the client who registered on the address.
- * @param address The address the newly registered handler listens on.
- * @return True, if the handler should still be registered, false otherwise.
- */
- boolean registeringHandler(String writeHandlerId, final String address);
-
- /**
- * This method gets fired when a client unregistered a handler for an address.
- * @param writeHandlerId The socket ID of the client who registered on the address.
- * @param address The address the unregistered handler listened on.
- */
- void unregisteredHandler(String writeHandlerId, final String address);
-
- /**
* This method gets fired when a client disconnects.
* @param writeHandlerId The socket ID of the client who disconnected.
*/
@@ -166,37 +166,16 @@ public void handle(Buffer data) {
String address = getMandatoryString(msg, "address");
switch (type) {
case "send":
- if (bridgeHook != null) {
- if (bridgeHook.sendingMessage(sock.writeHandlerID, address, msg)) {
- sendOrPub(true, msg, address);
- }
- } else {
- sendOrPub(true, msg, address);
- }
+ sendOrPub(true, msg, address);
break;
case "publish":
- if (bridgeHook != null) {
- if (bridgeHook.publishingMessage(sock.writeHandlerID, address, msg)) {
- sendOrPub(false, msg, address);
- }
- } else {
- sendOrPub(false, msg, address);
- }
+ sendOrPub(false, msg, address);
break;
case "register":
- if (bridgeHook != null) {
- if (bridgeHook.registeringHandler(sock.writeHandlerID, address)) {
- handleRegister(address);
- }
- } else {
- handleRegister(address);
- }
+ handleRegister(address);
break;
case "unregister":
handleUnregister(address);
- if (bridgeHook != null) {
- bridgeHook.unregisteredHandler(sock.writeHandlerID, address);
- }
break;
default:
throw new IllegalStateException("Invalid type: " + type);
@@ -14,26 +14,6 @@ server.requestHandler(function(req) {
var myListener = {
- sendingMessage: function(clientId, address, message) {
- log.push(clientId + ' sent ' + message.encode() + ' to ' + address);
- return true; // let the client send the message
- },
- publishingMessage: function(clientId, address, message) {
- log.push(clientId + ' tried to publish ' + message.encode() + ' to ' + address);
- return false; // don't let any publish methods through
- },
- registeringHandler: function(clientId, address) {
- if (address === 'secret') {
- log.push('did not allow ' + clientId + ' registering at ' + address);
- return false;
- } else {
- log.push(clientId + ' registered at ' + address);
- return true;
- }
- },
- unregisteredHandler: function(clientId, address) {
- log.push(clientId + ' unregistered handler at ' + address);
- },
clientDisconnected: function(clientId) {
log.push(clientId + ' disconnected');
}

0 comments on commit c11429a

Please sign in to comment.