Commit bb23f01d by Eli Ben Baruch

mde - phase 1 .bug fix

parent 681842b6
......@@ -11,19 +11,19 @@ public class OnEventDetails {
public String getCallBackUrl() {
return callBackUrl;
}
@JsonProperty("app-key")
@JsonProperty("appKey")
public String getAppKey() {
return appKey;
}
@JsonProperty("callbackUrl")
private String callBackUrl;
@JsonProperty("app-key")
@JsonProperty("appKey")
private String appKey;
@JsonCreator
public OnEventDetails(@JsonProperty("callbackUrl") String callBackUrl, @JsonProperty("app-key") String appKey) {
public OnEventDetails(@JsonProperty("callbackUrl") String callBackUrl, @JsonProperty("appKey") String appKey) {
this.callBackUrl = callBackUrl;
this.appKey = appKey;
}
......@@ -31,4 +31,10 @@ public class OnEventDetails {
public boolean isValid() {
return callBackUrl!=null;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Details=[url=").append(callBackUrl).append(",appKey=").append(appKey).append("]");
return sb.toString();
}
}
......@@ -298,7 +298,7 @@ public class WebSocketEventListener implements WebSocketListener {
@Override
public void onPingFrame(WebSocket websocket, WebSocketFrame frame) throws Exception {
String str = connectionId + " " +currentDate()+ "ping frame</a> (opcode = 0x9) was received: "+frame.toString();
logging(str, eTraceLevel.eDEBUG,true);
// logging(str, eTraceLevel.eDEBUG,true);
setState(websocket.getState());
}
......@@ -359,16 +359,7 @@ public class WebSocketEventListener implements WebSocketListener {
} catch (IOException e) {
e.printStackTrace();
}
// String appKey = details.getAppKey();
// StringBuilder sb=new StringBuilder("\{ \"op\"\: \"add\", \"path\"\: \"\\/app-key\"\:, \""+appKey+"\"\}");
// sb.append(appKey);
//// sb.append("\": { "availability": {"value": "unknown", "timestamp": 0, "mde-key": "$id"}}})
// jsonEvent = JsonPatchAction
// sendEvent()
}
}
}
} catch (IOException e1) {
......@@ -394,7 +385,7 @@ public class WebSocketEventListener implements WebSocketListener {
logging("sendHttpPost failed to send event with error: "+e, eTraceLevel.eERROR, true);
return;
}
logging("sendHttpPost event was send successfuly", eTraceLevel.eDEBUG, true);
logging("sendHttpPost event was send successfuly to"+callBackUrl, eTraceLevel.eDEBUG, true);
}
/**
......
......@@ -27,6 +27,7 @@ public class WebSocketManager {
this.defaultHeaders = defaultHeaders;
this.auth2Client = oAuth2Client;
}
public boolean isConnected( String connectionId, String uid){
......@@ -55,14 +56,17 @@ public class WebSocketManager {
webSocketConnection.wait();
if (webSocketConnection.getException()!=null)
throw webSocketConnection.getException();
else
webSocketConnections.put(connectionId,webSocketConnection);
else {
webSocketConnections.put(connectionId, webSocketConnection);
System.out.println("websocket created successfully: "+ connectionId+" "+ "uid="+uid+" "+ details.toString());
}
}
}
else{
webSocketConnection = webSocketConnections.get(connectionId);
webSocketConnection.addEventListener(uid,details);
System.out.println("websocket updated successfully: "+ connectionId+" "+ "uid="+uid+" was added to websocket. "+ details.toString());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment