Skip to content

Commit

Permalink
adding websocketUpdates in gatsby-node.js
Browse files Browse the repository at this point in the history
  • Loading branch information
iFlameing committed May 30, 2019
1 parent f5d2f7b commit 7195716
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ const fetchPloneNavigationNode = async (id, token, baseUrl) => {
// GatsbyJS source plugin for Plone
exports.sourceNodes = async (
{ actions, cache, getNode, getNodes, store },
{ baseUrl, token, searchParams, expansions, logLevel }
{ baseUrl, token, searchParams, expansions, logLevel, websocketUpdates }
) => {
const { createNode, deleteNode, setPluginStatus, touchNode } = actions;
let state = {},
Expand Down Expand Up @@ -371,7 +371,8 @@ exports.sourceNodes = async (
}
logger.info('Setting plugin status');
logger.debug(JSON.stringify(newState));
const socket = io('http://localhost:9000');
if(websocketUpdates){
const socket = io('http://localhost:9000');
socket.on('connect',(data)=>{
socket.on('welcome',(data)=>{
console.log("This is from gatsby nodejs",data);
Expand All @@ -385,6 +386,7 @@ exports.sourceNodes = async (
console.log(data)
})
})
}
setPluginStatus(newState);
logger.info('Done');
};
Expand Down

0 comments on commit 7195716

Please sign in to comment.