Software Development & Management

CRA and custom websockets

1 min min read - February 16, 2021

I have encountered a problem with my Create React App. Our app is quite big and custom. We don't have a benefit of rewriting it from scratch in Next.js or similar. We have a server that delivers static HTML, session data and an API over standard HTTP port. On production, we load all frontend scripts from the CDN, but on the development we have CRA running in parallel. Server router proxies HTML files, but assets are being loaded from CRA port, 5000 in that case.

With craco and react-app-rewired it was pretty easy to amend the public path for the dev environment, but changing behaviour of hot module replacement was a different story. Because of CRA and their lifecycles, both projects have problem with an instrumenting dev server. I almost gave up and decided to eject the app. And then I realised that CRA finally supports customisation of web sockets configuration via environment variables (doc here, blame here). That won't allow you to easily disable them, but at least you can resolve all other issues around proxying them.

Next article

Private

It may be already more than two years as I try to deliver this project. I had to start it from scratch as the environment changed. Had to rethink the approach and learn more about publishing, writing and the subject itself. But it seems I'm on the right course to deliver this year. Becoming a Software Developer is meant to be a testimony to my journey, baked in a way that could show the path to the others. During over twenty years in the trade, I trained multiple developers, succeeded and failed. I had a chance to learn from great mentors and see those not worth following. I noticed that many books for people who aspire to work in software engineering focus only on the technical aspects. Few that try to tackle other areas seem to be soulless career self books. I still miss something that you could relate to, which helps you choose your destination before the deep dive. People who enter #100daysofcode or similar challenges this way burn out very fast. They miss the point, as often they have no idea what the skills they learn will be used for.

read more…

1 min min read - February 16, 2021

Previous article

Private

This year was a massive challenge to everyone but also brought a positive change. Don't remember any such eventful year before, so to sum up everything I will make a bullet point list.

read more…

2 min min read - December 31, 2020