Skip to content

Commit

Permalink
testing with timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
iFlameing committed May 28, 2019
1 parent 46506fc commit f5d2f7b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
26 changes: 26 additions & 0 deletions mock-Server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@ io.on('connection', (socket, req) => {
socket.on('message', (msg) => {
console.log(msg);
})
setTimeout(()=>{
socket.emit('setTimeout',JSON.stringify({
"created": [{
"@id": "http://localhost:8080/...",
"parent": {
"@id": "http://localhost:8080/..."
}
}]
},
{
"modified": [{
"@id": "http://localhost:8080/...",
"parent": {
"@id": "http://localhost:8080/..."
}
}]
},
{
"removed": [{
"@id": "http://localhost:8080/...",
"parent": {
"@id": "http://localhost:8080/..."
}
}]
}))
}, 5000)
})


Expand Down
9 changes: 8 additions & 1 deletion src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,14 @@ exports.sourceNodes = async (
socket.on('welcome',(data)=>{
console.log("This is from gatsby nodejs",data);
})
socket.emit('message',{data:'I am Excited'})
setTimeout(()=>{
socket.emit('message',{data:'I am Excited'})

},5000);
socket.on('setTimeout',(data) => {
console.log("this is from the json payload after some timeout");
console.log(data)
})
})
setPluginStatus(newState);
logger.info('Done');
Expand Down

0 comments on commit f5d2f7b

Please sign in to comment.