Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery
/
mde
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bb23f01d
authored
Dec 06, 2016
by
Eli Ben Baruch
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
mde - phase 1 .bug fix
parent
681842b6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
16 deletions
src/main/java/logic/webSocket/OnEventDetails.java
src/main/java/logic/webSocket/WebSocketEventListener.java
src/main/java/logic/webSocket/WebSocketManager.java
src/main/java/logic/webSocket/OnEventDetails.java
View file @
bb23f01d
...
...
@@ -11,19 +11,19 @@ public class OnEventDetails {
public
String
getCallBackUrl
()
{
return
callBackUrl
;
}
@JsonProperty
(
"app
-k
ey"
)
@JsonProperty
(
"app
K
ey"
)
public
String
getAppKey
()
{
return
appKey
;
}
@JsonProperty
(
"callbackUrl"
)
private
String
callBackUrl
;
@JsonProperty
(
"app
-k
ey"
)
@JsonProperty
(
"app
K
ey"
)
private
String
appKey
;
@JsonCreator
public
OnEventDetails
(
@JsonProperty
(
"callbackUrl"
)
String
callBackUrl
,
@JsonProperty
(
"app
-k
ey"
)
String
appKey
)
{
public
OnEventDetails
(
@JsonProperty
(
"callbackUrl"
)
String
callBackUrl
,
@JsonProperty
(
"app
K
ey"
)
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
();
}
}
src/main/java/logic/webSocket/WebSocketEventListener.java
View file @
bb23f01d
...
...
@@ -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
);
}
/**
...
...
src/main/java/logic/webSocket/WebSocketManager.java
View file @
bb23f01d
...
...
@@ -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
());
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment