@iFlameing For a development websocket server a minimal chat server could work https://socket.io/get-started/chat/
Just create that chat example separately from gatsby-source-plone
Next make gatsby-source-plone connect that server with websocket (believing that it is Plone)
Finally use the chat client example to publish messages from browser to gatsby-source-plone through that websocket server.
@iFlameing Something else you probably need to learn for this is using node debugger https://nodejs.org/en/docs/guides/debugging-getting-started/
For example, you should be able to run gatsby develop with debugger with
node --inspect node_modules/.bin/gatsby develop. With debugging mode you should be able to add "debugger" break points into the code and e.g. have interactive repl to figure things out when websocket connection gets a message.
@iFlameing Please, try to transform the main tasks from your GSOC project plain into tasks or real issues into https://github.com/collective/gatsby-source-plone/projects/2
I'm working on Docker image with Plone and websockets on next Tuesday, but it might still take another week for me to complete it. So you should probably start as you planned.
Let's try to find a time when I would be available here every week so that we could prevent blocking issues. I am on UTC+3 so I assume that we could have that time around you Monday noon or aftertnoon. Something between 6am UTC and 8am UTC should fit for me.
Yet, the best way to ask questions is either using GitHub issues or here. Remember to tag me so that I get notifications.
@iFlameing Today is the start day of the coding phase.
You should start by re-reading the rules on how to publish the results at the end of the GSOC:
Make your work visible by using GitHub project board tasks, GitHub issues and commit all your work into feature branches so that they could be discussed and merged with pull requests.
During the last years it has been ok to make the final report as GitHub Gist referring and explaining all the pull request done for the code.
@iFlameing I got an MVP for websocket notifications like defined in https://github.com/collective/gatsby-source-plone/pull/176#issuecomment-496275066 implemented, I did not get it dockerized yet. But most probably you will get a Docker image with these notifications in 1-2 weeks.
The first version requires no interaction nor authentication with the server.
Once I have automated Docker image building for that I'll add authentication (Authorization-token during websocket connect) and require some subscription call before notifications are being sent.
websocketUpdatesthat we mention in the pull request collective/gatsby-source-plone#176. Currently I am working on sending json data from mock server to gatsby-plugin using setTimeout and setInterval, I will make a commit once I tested successfully.
node --inspect node_modules/.bin/gatsby developI am getting error module gatsby not found. when I downloaded the gatsby once again and I ran the command once again it shows me module react not found and other dependencies on subsequent run. What should I do now?
@iFlameing I'm sorry for not trying that --inspect beforehand.
It seems that must be run in ./tests/gatsby-starter-default to work.
So, you need to remember to:
cd tests/gatsby-starter-plone node --inspect node_modules/.bin/gatsby develop
I should add a make target for that on some day...
cd tests/gatsby-starter-plone node inspect node_modules/.bin/gatsby develop
@iFlameing gatsby-source-plone Master has now Plone with websocket events
Once you have pulled master or merged origin master into your branch
make purge init-backend should switch the docker image
Currently simply opening websocket connection anywhere (e.g. baseUrl) at Plone will subscribe to those event. (There will be some handshake required and permissions checked later, but this should be already enough for you to be able to complete GSOC :)
Today I worked on Plone websocket design and implementation to allow restricting notifications by user permissions. I had progress, but was unable to complete the implementation today. So it probably takes another week until I can update the project with more production ready websocket support version.
Just tell me if it blocks your development that Plone sends notification for content that you don't have permissions. There is a manual workaround to make Plone publish all new content immediately.
@iFlameing Sounds good. So, after MVP, let's figure out a way to test all these before any cleanup refactoring.
tests for fetchUrl and fetchPlone provide an example how Plone could be mocked for testing https://github.com/collective/gatsby-source-plone/blob/master/src/__tests__/utils.tests.js#L90
At first, the use of http library should be parameterized so that any call to the library could be mocked with test fixture. This is already done for fetchUrl and fetchPlone, but not for any higher level functions.
Once it is possible to call more higher level functions with mock http interface, it should be possible to make that mock to serve the current JSON fixtures (from tests/gatsby-starter-default/fixture
But first things first. That is the MVP :)
As an almost unrelated thing, we just released the biggest GatsbyJS site so far: https://studyguide.jyu.fi/ (about 4000 pages)
There is no Plone content there yet (current content comes Hasura-enhanced PostgreSQL database), but the roadmap includes also CMS-content and Plone is the most probable solution to manage that.