Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery
/
devops
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9eaf05bb
authored
Nov 26, 2017
by
amir
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix overrite the json nodes
parent
5ee7a320
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
tools/wsEventEmulator/app.js
tools/wsEventEmulator/app.js
View file @
9eaf05bb
...
...
@@ -9,6 +9,8 @@ const request = require('request');
var
myArgs
=
require
(
'optimist'
).
argv
,
help
=
'node app.js -p port -f file-path [-d delay-between-samples --postUrl http url to post instead of websocket]'
;
//const twoDaysAgoMs = 1000 * 3600 * 47;
/**
* some validation
*/
...
...
@@ -92,11 +94,12 @@ var normalyzeEvent = function(eventObj){
var
sendJson
=
function
(){
wss
.
clients
.
forEach
(
function
each
(
client
)
{
var
eventObj
=
jsonFile
[
index
];
normalyzeEvent
(
eventObj
);
console
.
log
(
"sending: "
+
JSON
.
stringify
(
eventObj
));
var
newEventObj
=
JSON
.
parse
(
JSON
.
stringify
(
eventObj
))
normalyzeEvent
(
newEventObj
);
console
.
log
(
"sending: "
+
JSON
.
stringify
(
newEventObj
));
if
(
myArgs
.
postUrl
==
null
){
if
(
client
.
readyState
===
WebSocket
.
OPEN
)
{
client
.
send
(
JSON
.
stringify
(
e
ventObj
));
client
.
send
(
JSON
.
stringify
(
newE
ventObj
));
}
}
else
{
request
.
post
({
...
...
@@ -104,7 +107,7 @@ var sendJson = function(){
headers
:
{
"Content-Type"
:
"application/json"
},
body
:
e
ventObj
,
body
:
newE
ventObj
,
json
:
true
},
function
(
error
,
response
,
body
){
console
.
log
(
error
);
...
...
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